Magnolia 6.0 reached end of life on June 26, 2019. This branch is no longer supported, see End-of-life policy.
CompositeFieldDefinition defines a complex field that is composed of multiple simple fields. Use a composite field for objects that cannot be expressed as simple text strings or numbers such as:
class: info.magnolia.ui.form.field.definition.CompositeFieldDefinition
fieldType: composite
Here is a composite field that consists of a text field and a date field.
To export the content of the composite fields for translation via the CTS module, the composite
field type has to be registered in the configuration of the module. For details see Registering additional field types.
Simple composite field definition:
form: tabs: - name: tabEvent label: Event fields: - name: title fieldType: composite label: Event fields: - name: title fieldType: text label: Title - name: date fieldType: date label: Date
Node name | Value |
---|---|
form | |
tabs | |
tabEvent | |
fields | |
event | |
fields | |
title | |
fieldType | text |
label | Title |
date | |
fieldType | date |
label | Date |
fieldType | composite |
label | Event |
You can use common field properties and the following properties in a composite field definition:
Properties:
<composite field name> | required Name of parent composite field. |
| required Node containing child fields. |
| required Name of the child fields. You can use any simple field definition. |
| required Field definition class of the child field. |
| required/optional Any properties the child field supports. |
| optional, default is Defines the layout of the child fields: |
Properties specific to the composite field.
| required Definition class of the composite parent field. Use |
| optional, default is Custom property transformer definition. |
Best practice
When nesting composite fields, use the delegating transformer classes, DelegatingCompositeFieldTransformer or DelegatingMultiValueFieldTransformer, rather than the other available transformer classes.