mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#18862: Fixing filtering menu items based on current culture
Work Item: 18862 --HG-- branch : 1.x
This commit is contained in:
@@ -24,12 +24,22 @@ namespace Orchard.Core.Navigation.Services {
|
||||
if (menuPart != null) {
|
||||
var part = menuPart;
|
||||
|
||||
// fetch the culture of the menu item, if any
|
||||
string culture = null;
|
||||
// fetch the culture of the content menu item, if any
|
||||
var localized = part.As<ILocalizableAspect>();
|
||||
if(localized != null) {
|
||||
if (localized != null) {
|
||||
culture = localized.Culture;
|
||||
}
|
||||
else {
|
||||
// fetch the culture of the content menu item, if any
|
||||
var contentMenuItemPart = part.As<ContentMenuItemPart>();
|
||||
if (contentMenuItemPart != null) {
|
||||
localized = contentMenuItemPart.Content.As<ILocalizableAspect>();
|
||||
if (localized != null) {
|
||||
culture = localized.Culture;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (part.Is<MenuItemPart>())
|
||||
builder.Add(new LocalizedString(HttpUtility.HtmlEncode(part.MenuText)), part.MenuPosition, item => item.Url(part.As<MenuItemPart>().Url).Content(part).Culture(culture));
|
||||
|
Reference in New Issue
Block a user