Nuxeo Server

Custom Action Types

Updated: October 13, 2017 Page Information Edit on GitHub

This page is scheduled for review and update. Check back soon for updated content!

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

9 days ago manonlumeau NXDOC-1346-FT review screenshot
a year ago Solen Guitter 9
4 years ago Solen Guitter 7
4 years ago Solen Guitter 8
4 years ago Solen Guitter 6
4 years ago Solen Guitter 5
4 years ago Anahide Tchertchian 4 | typo
4 years ago Anahide Tchertchian 3 | add excerpt
4 years ago Anahide Tchertchian 2 | explain how to define a custom action type
4 years ago Anahide Tchertchian 1
History: Created by Anahide Tchertchian