Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

orchardcms

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?

like image 266
timoffei Avatar asked Aug 06 '12 11:08

timoffei


1 Answers

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.

like image 177
mdm Avatar answered Dec 31 '22 06:12

mdm