Search the documentation
 Show GitHub edit links  Hide GitHub edit links
In OpenCms since: 10.0 Documented since: 10.0 Latest revision for: 10.0 Valid for OpenCms: 10.5.3

Adding a new context menu item to the resource's context menu in the explorer is fairly easy since OpenCms 10.

In this topic, we only show the output of the example. To understand it, view the source (with an additional explanation) on GitHub.

The new context menu items added by the example

The example generates a new main menu item "Greet" with a subitem "Say Hello". Clicking on the sub-item you get an alert message, saying hello.

The visibility of the menu items is as follows:

  • For folders the item does not show up
  • For multiple resources, the item shows up, but is deactivated
  • For a single non-folder resource the item shows up and is active

This is illustrated by the following figures.

Fig. [greet_folder]: For folders the "Greet" item does not appear
Fig. [greet_none_folder]: For all resources that are no folder, the "Greet" item appears with active sub-item "Say hello"
Fig. [greet_many]: For more than one resource, the "Greet" item appears, but "Say Hello" is deactivated.
Fig. [greet_active]: When clicking "Say Hello" an alert box shows up, greeting the currently active user

You can improve this page

Please contribute your suggestions or comments regarding this topic on our wiki. For support questions, please use the OpenCms mailing list or go for professional support.