Creation of Admin Menu Plugin

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 лет назад
dotcontrol wrote:

public interface IAdminMenuPlugin : IPlugin
    {
        /// <summary>
        /// Authenticate a user (can he see this plugin menu item?)
        /// </summary>
        /// <returns></returns>
        bool Authenticate();

        /// <summary>
        /// Build menu item
        /// </summary>
        /// <returns>Site map item</returns>
        SiteMapNode BuildMenuItem();
    }



This does no follow the signature for iAdminMenuPlugin (not in 3.10 anyway). The example further up the page uses the correct signature:

ahill775 wrote:


   // Implement an admin link
        public void BuildMenuItem(MenuItemBuilder menuItemBuilder)
        {
            menuItemBuilder.Text("Display Name").Url("url path or absolute link").ImageUrl("link to the icon next to menu item");
        }



This can be extended to include submenus like this:


  public void BuildMenuItem(MenuItemBuilder menuItemBuilder)
  {
    menuItemBuilder.Text("Menu Name").Url("~/controller/action/");
    var items = new List<MenuItem>();
    var menu = new MenuItem()
    {
      Text = "Sub menu name",
      Url = "~/controller/action/"
    };
    items.Add(menu);
    menuItemBuilder.Items(items);
  }


This only adds items to the 'Plugins' menu though.

My question is, how do we add a new top level menu?

Thanks!
9 лет назад
u can not add a top level menu
8 лет назад
I believe you can through changing the Administration sitemap.config, can't you?  If you copy the siteMapNode nodes and change the resource or utilize a URL?
8 лет назад
u can do it in the up coming version Nop 3.6
8 лет назад
You have to modify sitemap.config to add or modify one menu for the top level or any level by adding like this and you have to know that all the admin menu is under the siteMapNode "Home" :

<siteMapNode title="Home" controller="Home" action="Overview">
             <siteMapNode title="NameMenu" nopResource="Displayed Name" controller="ControllerName" action="ActionName" ImageUrl="imgUrl" />


But the previous method is very basic and i invite you to create a new plugin that you have to create a new entity and think how to initialise it from the previous menu that is in the Xml file SiteMap.config.

Best Regards.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.