Addons

Custom Action Types

Updated: March 18, 2024

JSF UI Deprecation
This requires to have the JSF UI addon installed on your server that is deprecated since Nuxeo Platform LTS 2019.
Please refer to the Web UI documentation.

Since 5.8, it is easy to add your own action type to handle its configuration and display, rather than defining an action of type "template" and specifying the template each time it needs to be used.

You can take example on the "link" action type registration for this. It is actually relying on widget types definition, here is a minimal definition for a custom action type:

<extension target="org.nuxeo.ecm.platform.forms.layout.LayoutStore"
  point="widgettypes">

  <widgetType name="my_link">
    <categories>
      <category>jsfAction</category>
    </categories>
    <configuration>
      <properties>
        <defaultValues mode="any">
          <property name="discardSurroundingForm">false</property>
          <property name="supportAjax">#{canUseAjaxTabs}</property>
        </defaultValues>
      </properties>
    </configuration>
    <handler-class>
      org.nuxeo.ecm.platform.forms.layout.facelets.plugins.TemplateWidgetTypeHandler
    </handler-class>
    <property name="template">
      /incl/action/my_link_action_template.xhtml
    </property>
  </widgetType>

</extension>

The category jsfAction is used to filter this widget type from other widget types and make this one specific to actions display.

The configuration can hold default values to control default behavior:

  • discardSurroundingForm: makes it possible to avoid adding a form around an action that does not need it anyway (like a RESTful link).

  • supportAjax: makes it possible to avoid stating this property in all actions of this type (if Ajax is always supported, for instance).

The action template at "/incl/action/my_link_action_template.xhtml" may need to handle two modes specific to actions:

  • tab_content: used to define what should be displayed in the content of a tab for this action type.
  • after_view: used to define what should be displayed after the main rendering (e.g the action button), because that's useful to include content after the main form displaying an action bar, for instance. This mode is currently useful when defining fancyboxes that include a form.

Default action templates can also be browsed for examples.

 


Related pages in this documentation

Standard Action Types Actions Overview Action How-To Index

Related pages in Studio documentation

User Actions