AI OnAI Off
Hi Saurabh,
Just to clarify, when you're asking about the "Display Menu" are you asking about the "Display as" display options menu when placing a block in a content area or the "Select View" dropdown on the top right of the editor (or something else)?
If it's the display options menu used when placing a block in the content area, these options can be set by getting an instance of Episerver.Web.DisplayOptions and calling the "Add" method. You can see an example of this in the Alloy demo site in /Business/Initialization/DisplayRegistryInitialization.cs which is an initialisation module used to register the display options:
[InitializableModule] [ModuleDependency(typeof(EPiServer.Web.InitializationModule))] public class DisplayRegistryInitialization : IInitializableModule { public void Initialize(InitializationEngine context) { if (context.HostType == HostType.WebApplication) { // Register Display Options var options = ServiceLocator.Current.GetInstance<DisplayOptions>(); options .Add("full", "/displayoptions/full", Global.ContentAreaTags.FullWidth, "", "epi-icon__layout--full") .Add("wide", "/displayoptions/wide", Global.ContentAreaTags.TwoThirdsWidth, "", "epi-icon__layout--two-thirds") .Add("narrow", "/displayoptions/narrow", Global.ContentAreaTags.OneThirdWidth, "", "epi-icon__layout--one-third"); } } public void Preload(string[] parameters){} public void Uninitialize(InitializationEngine context){} }
Hello,
We have a requirement in which we have to add an item to the Display Menu while editing a block. Is this achievable?