Core Module Admin Settings

Topics: Writing modules
Jun 16, 2011 at 12:25 AM

We are building a Core module that will store a number of settings (remote service URL...) and handle the DAL that will be exposed to dependent modules within a suite we are building within Orchard for our specific vertical market. Would like to edit the settings from a submenu under Settings in the dashboard area, similar to General, Gallery, Comments, Email... . Have looked at some examples from both Orchard core and 3rd party modules to see how best to do it, and also read the "Add Custom Settings" documentation by Piotr Szmyd.

Can anyone assist in the simplest way to extend the Orchard Admin menu area? Can we add our own menu and submenu similar to Settings or Navigation as it is extended by the Advanced Menu module (also by Piotr)?

Coordinator
Jun 16, 2011 at 12:34 AM

What examples did you look at? From Orchard.Indexing, for example:

public class AdminMenu : INavigationProvider {
    public Localizer T { get; set; }
    public string MenuName { get { return "admin"; } }

    public void GetNavigation(NavigationBuilder builder) {
        builder.Add(T("Settings"),
            menu => menu.Add(T("Search Index"), "5", item => item.Action("Index", "Admin", new {area = "Orchard.Indexing"})
                    .Permission(StandardPermissions.SiteOwner)));
    }
}

Jun 16, 2011 at 7:26 AM
Edited Jun 17, 2011 at 2:05 AM

Great! Thanks for this. Was able to add a <New Menu> to both the Admin Menu and a sub-menu to Settings.

Tried adding a <New Sub Menu> to <New Menu> but unable to get it to show and now collapse/expand arrow appears. Any suggestions?

Jun 16, 2011 at 11:45 AM

It's worth knowing that when you implement global site settings (as per Piotr's article) a Settings submenu will be created if you specify a unique editor group.

Not sure why your submenu isn't working; you need to post your code.

Jun 21, 2011 at 11:34 PM

Thanks for this. All works well using the code posted + a unique editor group. Was able to create menu, sub-menu and local nav (tab) menus within Settings as well.