Added menu item to the main menu through INavigationProvider but it won't show?

不羁的心 提交于 2019-12-07 07:46:15

问题


Using Orchard cms 1.5.1 I have created a module which contains controller that fetches list from a web service. I want to add a menu item in main menu when this module is enabled. For that i have created MainMenu as follows:

public class MainMenu:INavigationProvider
{
    public Localizer T { get; set; }
    public String MenuName
    {
        get { return "main"; }
    }
    public void GetNavigation(NavigationBuilder builder)
    {
        builder.Add(menu => menu.Add(T("Fetched List"), "4", item => item.Action("Index", "FetchedList")));
    }
}

When my module is enabled, navigation won't show that menu item. Am i doing something wrong?


回答1:


From Orchard 1.5.0 onwards, INavigationProvider isn't used to build menus on the front end (it is still used to build the admin menu for the Dashboard though). You need to implement either IMenuProvider or INavigationFilter. See this post on David Hayden's blog for some pointers. You can also find good examples in both Orchard.Projections, and Orchard.CulturePicker.



来源:https://stackoverflow.com/questions/11827737/added-menu-item-to-the-main-menu-through-inavigationprovider-but-it-wont-show

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!