Documentation Center

Adding a menu item to a context menu

Add a menu item to a context menu to give users an access point to existing or new functionality.

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 menu item 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 id="MenuItemID" name="MenuItem" command="MenuItemCommand" />
    	<ext:menudeclaration>
    	<ext:dependencies>
    		<ext:dependency>MyCustomization.AllMyCommands</ext:dependency>
    	</ext:dependencies>
    	<ext:apply>
    		<ext:view name="VIEW_NAME">
    			<ext:control id="CONTEXTMENU_ITEM" />
    		</ext:view>
    	</ext:apply>
    </ext:extension>

    where MenuItemCommand refers to a command in one of your command sets.

    The ext:view identifies which context menu in which view the menu item should be added to: (in this example, the item is added to the main context menu in the main Content Manager Explorer view).

    Experience Manager context menu
    To add the menu item 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 the menu item to the context menu of the Content Manager Explorer user interface, replace VIEW_NAME with DashboardView and replace CONTEXTMENU_NAME with DashboardContextMenu.