سؤال

I'm trying to replace the Orchard CMS NavigationManager in Orchard.UI.Navigation so I can filter menu items based on permissions. Here is my code:

[OrchardSuppressDependency("Orchard.UI.Navigation.NavigationManager")]
public class MmtNavigationManager : NavigationManager
{

    public MmtNavigationManager(IEnumerable<INavigationProvider> providers, IAuthorizationService authorizationService, UrlHelper urlHelper, IOrchardServices orchardServices)
    : base(providers, authorizationService, urlHelper, orchardServices)
    {

    }

    public new IEnumerable<MenuItem> BuildMenu(string menuName)
    {
        var menu = base.BuildMenu(menuName);
        return menu;
    }
}

This code is in an installed and enabled module. The constructor gets called but never the BuildMenu method; The origional BuildMenu gets called instead.

Any ideas?

Thanks

هل كانت مفيدة؟

المحلول

Ah, sussed it out. I needed to make my new class (MmtNavigationManager) Inherit from INavigationManager as well.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top