mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#19495: Reorganizing MenuItemLink alternates
Work Item: 19495 --HG-- branch : 1.x
This commit is contained in:
@@ -101,15 +101,25 @@ namespace Orchard.Core.Shapes {
|
|||||||
builder.Describe("MenuItemLink")
|
builder.Describe("MenuItemLink")
|
||||||
.OnDisplaying(displaying => {
|
.OnDisplaying(displaying => {
|
||||||
var menuItem = displaying.Shape;
|
var menuItem = displaying.Shape;
|
||||||
var menu = menuItem.Menu;
|
string menuName = menuItem.Menu.MenuName;
|
||||||
menuItem.Metadata.Alternates.Add("MenuItemLink__" + EncodeAlternateElement(menu.MenuName));
|
string contentType = null;
|
||||||
|
|
||||||
if (menuItem.Content != null) {
|
if (menuItem.Content != null) {
|
||||||
var contentType = ((IContent) menuItem.Content).ContentItem.ContentType;
|
contentType = ((IContent) menuItem.Content).ContentItem.ContentType;
|
||||||
if (contentType != null) {
|
|
||||||
menuItem.Metadata.Alternates.Add("MenuItemLink__" + contentType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MenuItemLink__[ContentType] e.g. MenuItemLink-HtmlMenuItem
|
||||||
|
if (contentType != null) {
|
||||||
|
menuItem.Metadata.Alternates.Add("MenuItemLink__" + EncodeAlternateElement(contentType));
|
||||||
|
}
|
||||||
|
|
||||||
|
// MenuItemLink__[MenuName] e.g. MenuItemLink-Main-Menu
|
||||||
|
menuItem.Metadata.Alternates.Add("MenuItemLink__" + EncodeAlternateElement(menuName));
|
||||||
|
|
||||||
|
// MenuItemLink__[MenuName]__[ContentType] e.g. MenuItemLink-Main-Menu-HtmlMenuItem
|
||||||
|
if (contentType != null) {
|
||||||
|
menuItem.Metadata.Alternates.Add("MenuItemLink__" + EncodeAlternateElement(menuName) + "__" + EncodeAlternateElement(contentType));
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.Describe("LocalMenu")
|
builder.Describe("LocalMenu")
|
||||||
|
Reference in New Issue
Block a user