mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-01-23 05:12:09 +08:00
If MenuPart is a ContentMenuItem, check if the content is published before adding it to the NavigationBuilder. (#8653)
This commit is contained in:
committed by
GitHub
parent
9728831556
commit
7ac17272d2
@@ -23,6 +23,15 @@ namespace Orchard.Core.Navigation.Services {
|
|||||||
if (menuPart != null) {
|
if (menuPart != null) {
|
||||||
var part = menuPart;
|
var part = menuPart;
|
||||||
|
|
||||||
|
var showItem = true;
|
||||||
|
// If the menu item is a ContentMenuItemPart (from Orchard.ContentPicker), check the ContentItem is published.
|
||||||
|
// If there is no published version of the ContentItem, the item must not be added to NavigationBuilder.
|
||||||
|
var cmip = ((dynamic)part).ContentMenuItemPart;
|
||||||
|
if (cmip != null) {
|
||||||
|
showItem = cmip.Content != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showItem) {
|
||||||
string culture = null;
|
string culture = null;
|
||||||
// fetch the culture of the content menu item, if any
|
// fetch the culture of the content menu item, if any
|
||||||
var localized = part.As<ILocalizableAspect>();
|
var localized = part.As<ILocalizableAspect>();
|
||||||
@@ -38,4 +47,5 @@ namespace Orchard.Core.Navigation.Services {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user