Core/Contents: ContentsHandler now initializes the DisplayText to the content item's ContentType

This commit is contained in:
Lombiq
2019-09-05 22:30:33 +02:00
committed by Benedek Farkas
parent 7d2dd28404
commit 026f81fd16

View File

@@ -4,6 +4,9 @@ using Orchard.ContentManagement.Handlers;
namespace Orchard.Core.Contents.Handlers {
public class ContentsHandler : ContentHandlerBase {
public override void GetContentItemMetadata(GetContentItemMetadataContext context) {
if (string.IsNullOrWhiteSpace(context.Metadata.DisplayText))
context.Metadata.DisplayText = context.ContentItem.ContentType;
if (context.Metadata.CreateRouteValues == null) {
context.Metadata.CreateRouteValues = new RouteValueDictionary {
{"Area", "Contents"},
@@ -12,6 +15,7 @@ namespace Orchard.Core.Contents.Handlers {
{"Id", context.ContentItem.ContentType}
};
}
if (context.Metadata.EditorRouteValues == null) {
context.Metadata.EditorRouteValues = new RouteValueDictionary {
{"Area", "Contents"},
@@ -20,6 +24,7 @@ namespace Orchard.Core.Contents.Handlers {
{"Id", context.ContentItem.Id}
};
}
if (context.Metadata.DisplayRouteValues == null) {
context.Metadata.DisplayRouteValues = new RouteValueDictionary {
{"Area", "Contents"},
@@ -28,6 +33,7 @@ namespace Orchard.Core.Contents.Handlers {
{"Id", context.ContentItem.Id}
};
}
if (context.Metadata.RemoveRouteValues == null) {
context.Metadata.RemoveRouteValues = new RouteValueDictionary {
{"Area", "Contents"},