Startseite / Plugin-Entwicklung / SiteArchitect-Erweiterungen / Interaktive Features / Kontextmenüeinträge / Funktionsübersicht
Context Menu Items: Functional Overview
Using context menu items, FirstSpirit Module developers may add additional functionality to the context menus of store elements.
Menu items may be added into either the "New" or the "Plug-ins" submenus as well as - using a toolbar items plug-in - as a submenu of an editorial toolbar button and will operate within the context of the store element for which the context menu instance was created. Each item provided by a context menu plug-in may implement either a clickable menu item (triggering a programmatic action when clicked) or a grouping menu item (providing a submenu of further menu items).
Functionality
Context menu items may be inserted into the New and Plug-Ins groups of store element context menus as well as into a submenu of a grouping button shown in the editorial toolbar (see Toolbar Items). These menu items work in the context of the store element(s) for which the context menu is displayed.
The FirstSpirit Developer API provides two interfaces for context menu plug-ins which determine the location where menu items will be displayed:
- New Menu Items Plug-In
inserts one or several context menu items into the New group of store context menus.
Developer API documentation: JavaClientContextNewMenuItemsPlugin - Plug-Ins Menu Items Plug-In
inserts one or several context menu items into the Plug-Ins group of store context menus.
Developer API documentation: JavaClientContextPluginsMenuItemsPlugin
Both of these plug-in types provide one or more menu items that follow different interaction patterns:
- Executable
implements an executable context menu item. On click, its executable method is called.
Developer API documentation: ExecutableContextMenuItem - Grouping
implements a group container that contains one or more additional menu items. This item type has no executable interaction component.
Developer API documentation: GroupingContextMenuItem - Separator
inserts a separator into a context menu list, providing a means to visually group and distinguish items of related functionality within the same context menu. This item type has no executable interaction component.
Developer API documentation: SeparatorContextMenuItem
Example Implementation
The Server and SiteArchitect Examples source code package contains example implementations that demonstrate both context menu item kinds introduced in the Functionality section as well as use of the separator item.
The two plug-in classes produce the same menu structure consisting of an executable context menu item and a grouping context menu item. The distinguishing factor is the location in a store context menu at which these plug-ins' menu items are placed:
- ExampleJavaClientContextNewMenuItemsPlugin provides context menu items which are inserted into the "New" submenu of the store context menu.
- ExampleJavaClientContextPluginsMenuItemsPlugin provides context menu items which are inserted into the "Plug-ins" submenu of the store context menu.
- The class ExampleExecutableContextMenuItem implements a simple context menu item with an action that is executed on-click.
- The class ExampleGroupingContextMenuItem implements a grouping context menu item which provides a submenu consisting of several ExampleExecutableContextMenuItem instances as well as a separator.
Code Example
The Context Menu Items Code Example introduces and documents the implementation workflow and points out general considerations in designing plug-ins providing menu items.