Create an extra menu item - Enterprise Java Content management system - Hippo CMS

This article covers a Hippo CMS version 7.9. There's an updated version available that covers our most recent release.

Create an extra menu item

Menu plugin

If users should initiate some of the workflow actions from the CMS 7 GUI, a module should contain:

  1. Plugin: a Wicket Java class. A standard plugin requires only copy/paste.
  2. Plugin html: The html for the Wicket Java class.
  3. Plugin properties files: Files for translations of words shown in the GUI.
  4. Icons to show on the buttons that are for initiating workflow actions.

In addition, the repository bootstrap content should contain configuration to define when & where the plugin should be created.

Folder context menu

The folder context menu is defined by the workflow category 'threepane'. It contains different configurations for the admin, editor & author roles.

As an example, a simple 'index' button will be added to the menu. Clicking it will create a document named 'index' of a particular type.

Plugin Wicket java class -

package com.mycompany;

import org.apache.wicket.model.StringResourceModel;
import org.apache.wicket.request.resource.PackageResourceReference;
import org.apache.wicket.request.resource.ResourceReference;
import org.hippoecm.addon.workflow.StdWorkflow;
import org.hippoecm.addon.workflow.WorkflowDescriptorModel;
import org.hippoecm.frontend.plugin.IPluginContext;
import org.hippoecm.frontend.plugin.config.IPluginConfig;
import org.hippoecm.frontend.service.render.RenderPlugin;
import org.hippoecm.repository.api.WorkflowDescriptor;
import org.hippoecm.repository.standardworkflow.FolderWorkflow;

public class IndexWorkflowPlugin extends RenderPlugin<WorkflowDescriptor> {

    private static final long serialVersionUID = 1L;

    public IndexWorkflowPlugin(IPluginContext context, IPluginConfig config) {
        super(context, config);

        add(new StdWorkflow<FolderWorkflow>("index",
                new StringResourceModel("index", this, null),
                (WorkflowDescriptorModel) getModel()) {

            protected ResourceReference getIcon() {
                return new PackageResourceReference(getClass(), "workflow-16.png");

            protected String execute(FolderWorkflow workflow) throws Exception {
                workflow.add("new-document", "myns:index", "index");
                return null;

Above you see the code for the IndexWorkflowPlugin class. This class uses Wicket to add a button in the CMS GUI and defines which workflow action is performed if that button is pressed.

Elaborate custom plugin

Add your own code for a more elaborate custom plugin. To understand the above plugin first, lets dissect it: It uses a call to the Wicket add method to add a button for the 'index' workflow action. An anonymous inner Std Workflow subclass overrides the getIcon and the execute methods. The StringResourceModel is a Wicket class that allows the "index" string to be replaced by entries from the properties file.

Plugin Wicket HTML - IndexWorkflowPlugin.html

The markup file should be located right next to the java file in the package. Make sure the pom is configured such that it is copied.

<html xmlns:wicket="">
    <div wicket:id="index">[ WORKFLOW ]</div>

Above you see the Wicket HTML file. The wicket ID named "index" is given to a <div> inside of a Wicket panel. The string ' [ WORKFLOW ]' will be replaced by the Wicket with the button we are making.

Plugin Wicket properties file -

index: Create index

Above you see the complete wicket properties file. An name for the key 'index' is specified. The name is 'Create index'. You can have a different properties file for different languages.

For example for dutch

index: Creeer index

Repository Configuration

The plugin needs to be loaded as part of the plugin cluster for the context menu. This menu is defined in the 'threepane' category, /hippo:configuration/hippo:workflows/threepane, where three nodes define the clusters (for admin, editor & author users, respectively):


  • folder-permissions/frontend:renderer
  • folder-extended/frontend:renderer
  • folder/frontend:renderer


Bootstrapping the following snippet should do the trick:

<?xml version="1.0" encoding="UTF-8"?>
<sv:node sv:name="export" xmlns:sv="">
  <sv:property sv:name="jcr:primaryType" sv:type="Name">
  <sv:property sv:name="plugin.class" sv:type="String">
  <sv:property sv:name="" sv:type="String">


Document editor menu

The document editor menu is very similar to the folder context menu case. The main differences are the workflow category & the workflow type.

The plugin cluster that contains the standard menu items is located at /hippo:configuration/hippo:workflows/default/handle/frontend:renderer. The workflow type in use here is the DocumentWorkflow.

Sub menu

Since the document editor menu is hierarchical, rather than flat like the context menu, menu items here can use additional control over their positioning. Override the getSubMenu method to control in which dropdown the item should appear. The submenu 'top' is special; the button will be rendered in the menu bar. Use a different name (e.g. 'document' or 'publication') to add the item to an existing sub-menu.

If a new sub menu is appropriate, it's (localized) name should be made available. This can most easily be achieved by adding additional translation nodes to /hippo:configuration/hippo:frontend/cms/cms-preview/workflowMenuTranslator/hippostd:translations.