Domanda

Following the PiranhaCMS 2.2.0 documentation does not insert the menu items into the Manager menu.

What am I doing wrong?

I've placed this in my _AppStart.cshtml

Manager.Menu.Add(new Manager.MenuGroup()
    {
        InternalId = "MyApp",
        Name = "My app",
        CssClass = "fancy-icon"
    });

/* From this point down - also tried placing in _ViewStart.cshtml */
Manager.Menu.Where(m => m.InternalId == "MyApp").Single().Items.Add(
  new Manager.MenuItem() {
    Name = "Products",
    Action = "productlist",
    Controller = "products",
    Permission = "ADMIN_PRODUCT",
    SelectedActions = "productlist,productedit"
  });

Manager.Menu.Where(m => m.InternalId == "MyApp").Single().Items.Add(
  new Manager.MenuItem() {
    Name = "Product groups",
    Action = "productgrouplist",
    Controller = "products",
    Permission = "ADMIN_PRODUCTGROUP",
    SelectedActions = "productgrouplist,productgroupedit"
  });

However, even though the code is hit, and I can see that the Manager.Menu has the new items in it - they don't render in the Manager Menu.

What am I missing here? Where should I place the actual Menu inserts?

Thanks.

È stato utile?

Soluzione

The code above seems pretty much copied from the example at http://piranhacms.org/docs/extend/manager-menu. If you take a look at the last paragraph in the documentation you can see that in the above example two custom permissions have been added for the new manager functions (ADMIN_PRODUCT, ADMIN_PRODUCTGROUP).

Since the manager only renders items accessible by the logged in user I can only assume that you haven't added these permissions under System > Permissions which results in the current user not have access to them. And since the user hasn't access to any items in the group, the entire group is hidden!

Just remove the Permission = "..." from you items and they should render.

Regards

Håkan

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top