Both layouts and widgets have modes, that makes it possible to render the same layout in different use cases, even if some only support a simple "view" mode.
The layout modes can be anything although some default modes are included in the application: create
, edit
, view
. Some additional modes are available: listing
, search
, bulkEdit
, header
, csv
, pdf
and plain
.
The widget modes are more restricted and widget types will usually only handle two modes: edit
and view
. Some additional modes are available by default: pdf
, csv
and plain
(very close to the view
mode except it's not supposed to include HTML tags). These additional modes are useful when exporting listings. The widget mode is computed from the layout mode (or from its parent widget mode).
Here is a table of the default mappings:
Layout Mode | Default Widget Mode |
---|---|
create, edit, search, bulkEdit | edit |
view, summary | view |
csv | csv |
any other value | plain |
The pseudo mode any
is only used in layouts and widgets definitions to set up default values.
It is possible to override this behavior in the widget definition and state that, for instance, whatever the layout mode, the widget will be in view
mode. This enables to make the widget display only read-only values. The pseudo-mode hidden
can also be used in a widget definition to exclude this widget from the layout in a given mode.
It is also possible to use expressions to resolve this mode, for instance the following expression can be used to hide a widget displaying the dublincore
field named format
in view
mode if this property is not filled on the document:
<widgetModes>
<mode value="view">#{empty layoutValue.dc.format?'hidden':'view'}</mode>
</widgetModes>
See Field Binding and Expressions for more informations about available expression variables.