Documentation Center

Adding a separator or submenu to a context menu

Add a separator or a submenu to a context menu to set a group of related controls apart.

Procedure

  1. Open the configuration file of your custom Editor in a plain-text or XML editor.
  2. In the extensions section, locate the ext:contextmenus section. Inside this section, create or find an <ext:add> element.
  3. For each submenu you want to add to a context menu, insert an ext:extension element that looks as follows:
    <ext:extension name="NewMenuItem" assignid="NewMenuItemID"	insertbefore="cm_sep_1">
    	<ext:menudeclaration>
    		<cmenu:ContextMenuItem name="MenuItem" type="submenu">
    		</cmenu:ContextMenuItem>
    	<ext:menudeclaration>
    	<ext:apply>
    		<ext:view name="VIEW_MENU">
    			<ext:control id="CONTEXTMENU_NAME" />
    		</ext:view>
    	</ext:apply>
    </ext:extension>

    You can now add cmenu:ContextMenuItem elements inside the new cmenu:ContextMenuItem element to fill the submenu.

  4. For each separator you want to add to a context menu insert an ext:extension element that looks as follows:
    <ext:extension name="NewMenuItem" assignid="NewMenuItemID"	insertbefore="cm_sep_1">
    	<ext:menudeclaration>
    		<cmenu:ContextMenuItem name="MenuItem" type="separator" />
    	<ext:menudeclaration>
    	<ext:apply>
    		<ext:view name="VIEW_MENU">
    			<ext:control id="CONTEXTMENU_NAME" />
    		</ext:view>
    	</ext:apply>
    </ext:extension>

    This inserts a separator at the position you specify.

  5. In all ext:view sections you created, specify the view name and context menu name as follows:
    Experience Manager context menu
    To add your submenu or separator to the context menu that end users see when they edit a Web page, replace VIEW_NAME with EditorView and replace CONTEXTMENU_NAME with EditorContextMenu.
    Content Manager Explorer context menu
    To add your submenu or separator to the context menu of the Content Manager Explorer user interface, replace VIEW_NAME with DashboardView and replace CONTEXTMENU_NAME with DashboardContextMenu.
  6. Save and close your Editor's configuration file.