RSS Amplifier

Gulla.net · Oct 3, 2024

Add your own tools to the Optimizely CMS 12 admin menu

0
Sign in to vote or save

Tomas Hensrud Gulla · Tomas Hensrud Gulla

  1. Home
  2. Blog
  3. Add your own tools to the Optimizely CMS 12 admin menu

The menus in Optimizely CMS can be extended using a MenuProvider, and using the path parameter you decide what menu you want to add additional menu items to.

In order to add a new menu item, with a heading, to the bottom of the settings section, like this...

Updated Optimizely CMS admin menu, with new section

...add the following code.

[MenuProvider]
public class PluginMenuProvider : IMenuProvider
{
    public IEnumerable<MenuItem> GetMenuItems()
    {
        yield return new UrlMenuItem(
            "Custom Tools",
            "/global/cms/admin/customtools",
            null)
        {
            IsAvailable = context => PrincipalInfo.CurrentPrincipal?.IsInRole("WebAdmins") == true,
            SortIndex = 100
        };
        yield return new UrlMenuItem(
            "List content by type",
            "/global/cms/admin/customtools/listcontentbycontenttype",
            "/EPiServer/listcontentbycontenttype")
        {
            IsAvailable = context => PrincipalInfo.CurrentPrincipal?.IsInRole("WebAdmins") == true,
            SortIndex = 100
        };
    }
}

That's it!

Read the original on gulla.net

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.