Can't get OrchardSuppressDependency to work

Topics: Writing modules
Jun 21, 2012 at 12:34 PM

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

 

Jun 21, 2012 at 12:56 PM

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