Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

Kristoffer Lindén
Dec 8, 2021
(0 votes)

Create your own menu to handle your custom plugin

So in CMS 11 when you wrote your plugin you easily add settings to your plugin using GuiPlugin attribute and adding properties using the PlugInProperty attribute.
In CMS 12 that is not longer possible so the best is instead to create your own top menu item with a submenu that contains for example Dashboard and Settings.

The menu provider could look like this:

public class MyPluginMenuProvider : IMenuProvider
    private readonly LocalizationService _localizationService;

    public MyPluginMenuProvider(LocalizationService localizationService)
        _localizationService = localizationService;

    public IEnumerable<MenuItem> GetMenuItems()
        var mainMenuItem =
            new UrlMenuItem("My plugin", MenuPaths.Global + "/cms/myplugin", null)
                IsAvailable = context => true,
                SortIndex = SortIndex.Last + 100,
                AuthorizationPolicy = CmsPolicyNames.CmsAdmin

        var dashboardMenuItem =
            new UrlMenuItem(_localizationService.GetString("/Plugin/DisplayName"),
                MenuPaths.Global + "/cms/myplugin/dashboard", "/MyPlugin/Dashboard/Index")
                IsAvailable = context => true,
                SortIndex = 100,
                AuthorizationPolicy = CmsPolicyNames.CmsAdmin

        var settingsMenuItem =
            new UrlMenuItem(_localizationService.GetString("/Plugin/Settings"),
                MenuPaths.Global + "/cms/myplugin/settings", "/MyPlugin/Settings/Index")
                IsAvailable = context => true,
                SortIndex = 200,
                AuthorizationPolicy = CmsPolicyNames.CmsAdmin

        return new List<MenuItem>

That would give you this look:

Your layout view should look something like this to have the Optimizely menu to render:

@using EPiServer.Framework.Web.Resources
@using EPiServer.Shell.Navigation

<!DOCTYPE html>
<html lang="en">
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title>My Plugin</title>

        <!-- Shell -->

        <!-- LightTheme -->

        <div @Html.ApplyPlatformNavigation()>

When this is done you can easily work with your dashboard and settings functions.

Thanks Scott Reed for enlighting me in this forum post:

You can read more here:


Dec 08, 2021


Please login to comment.
Latest blogs
Join the Work Smarter Webinar: Working with the Power of Configured Commerce (B2B) Customer Segmentation December 7th

Join this webinar and learn about customer segmentation – how to best utilize it, how to use personalization to differentiate segmentation and how...

Karen McDougall | Dec 1, 2023

Getting Started with Optimizely SaaS Core and Next.js Integration: Creating Content Pages

The blog post discusses the creation of additional page types with Next.js and Optimizely SaaS Core. It provides a step-by-step guide on how to...

Francisco Quintanilla | Dec 1, 2023 | Syndicated blog

Stop Managing Humans in Your CMS

Too many times, a content management system becomes a people management system. Meaning, an organization uses the CMS to manage all the information...

Deane Barker | Nov 30, 2023

A day in the life of an Optimizely Developer - Optimizely CMS 12: The advantages and considerations when exploring an upgrade

GRAHAM CARR - LEAD .NET DEVELOPER, 28 Nov 2023 In 2022, Optimizely released CMS 12 as part of its ongoing evolution of the platform to help provide...

Graham Carr | Nov 28, 2023