Actions are grouped in categories to be able to display them in the same area of a page. Widgets can be used to handle rendering of these actions.
Actions are referencing the same category when they need to be displayed in the same area of a page.
The available categories are listed below and can also be found by checking action contributions on the explorer.
CAP Categories
CAP Advanced Categories
These categories can be useful when defining custom actions, that will reference the widgets to display. This is useful when building incremental layouts, like the default summary layout starting from 5.6: the action order and filter information are useful to contribute/display/hide some widgets to the summary default layout.
These categories are not really useful when defining user actions, and the associated features can be broken when migrating from 5.6 to 5.8, as the form around the summary layout has been removed for 5.8 to allow fine-grained form management on this page.
View Action List
Technical name: VIEW_ACTION_LIST
.
This category is used for tabs displayed on every document.
<action id="TAB_VIEW" link="/incl/tabs/document_view.xhtml" enabled="true"
order="0" label="action.view.summary" type="rest_document_link">
<category>VIEW_ACTION_LIST</category>
<filter-id>view</filter-id>
</action>
<action id="TAB_CONTENT" link="/incl/tabs/document_content.xhtml" order="10"
enabled="true" label="action.view.content" type="rest_document_link">
<category>VIEW_ACTION_LIST</category>
<filter-id>view_content</filter-id>
</action>
DAM Categories
Adapting Templates to Display an Action
Since Nuxeo Platform 5.6, an action can define the way it will be rendered by using the type
attribute. This make it easier to combine different kinds of rendering for a group of actions, and this is done by using widget types for action types, to leverage features from the Nuxeo Layout Framework.
The template
action type makes it possible to define a custom action rendering. New action types can also be contributed to the framework.
A series of widget types displaying are available by default, see the pages Tab Designer Widget Types and Advanced Widget Types. These widget types include rendering configuration options that are implemented by default action widget types (CSS styling, display as buttons or links, for instance).
Here are two ways of rendering actions.
Rendering Actions via Widget Definitions
Here is a sample widget definition to render actions using category MY_CATEGORY
:
<extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
point="widgets">
<widget name="userActions" type="documentActionsWithForms">
<properties mode="view">
<property name="category">MY_CATEGORY</property>
<property name="actionsDisplay">links</property>
<property name="overallDisplay">horizontal_block</property>
<property name="styleClass">userActions</property>
</properties>
</widget>
</extension>
This widget can be displayed on a page directly using the following sample code:
<div xmlns:nxl="http://nuxeo.org/nxforms/layout">
<nxl:widget name="userActions" mode="view" value="#{currentDocument}" />
</div>
Of course this widget definition can also be included within a layout definition, as it's done for Incremental Layouts configuration.
Rendering Actions via Dynamically Computed Widget
It can also be useful to generate the widget definition dynamically from the widget template, by passing the widget properties as tag attributes to the nxl:widgetType
tag:
<div xmlns:nxl="http://nuxeo.org/nxforms/layout">
<nxl:widgetType name="documentActionsWithForms"
widgetName="documentActionsUpperButtons"
mode="view"
label=""
actionStyleClass="button"
actionsDisplay="icons"
overallDisplay="horizontal_block"
widgetProperty_category="MY_CATEGORY"
maxActionsNumber="5"
value="#{currentDocument}" />
</div>
Notice the tag attribute widgetProperty_category
used to define the actions category: as widget types also have a notion of category, adding widgetProperty_
prefix to the attribute makes it possible to explicitly state that this is a widget property.
See also chapter about Layout and Widget Display.