Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Javadoc
rangeHigherVersion5.5
className0info.magnolia.ui.form.field.definition.CompositeFieldDefinition
renderTypeasynchronous
 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:

  • Setting conditions for selecting the next step in a multistep form.
  • Assigning categories to a content item, where the composite field consists of a category dropdown and a button for reordering categories.
  • Defining an image gallery using a media select field, where the composite media field consist of a thumbnail and caption text. 
  • Specifying an access control list for JCR workspaces, where the composite ACL field consists of permission, scope and path.

Classclassinfo.magnolia.ui.form.field.definition.CompositeFieldDefinition

Here is a composite field that consists of a text field and a date field.

Info

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.

Table of Contents

Composite field properties

...

Localtab Group
Localtab
activetrue
titleYAML file
Code Block
languagejs
form:
  tabs:
    - name: tabEvent
      label: Event
      fields:
        - name: title
          class: info.magnolia.ui.form.field.definition.CompositeFieldDefinition
          label: Event
          fields:
            - name: title
              class: info.magnolia.ui.form.field.definition.TextFieldDefinition
              label: Title
            - name: date
              class: info.magnolia.ui.form.field.definition.DateFieldDefinition
              label: Date
Localtab
titleJCR node
Advanced Tables - Table Plus
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
Node nameValue

Mgnl n
form

 


Mgnl n
tabs

 


Mgnl n
tabEvent

 


Mgnl n
fields

 


Mgnl n
event

 


Mgnl n
fields

 


Mgnl n
title

 

Mgnl p
class

info.magnolia.ui.form.field.definition.TextFieldDefinition

Mgnl p
label

Title

Mgnl n
date

 


Mgnl p
class

info.magnolia.ui.form.field.definition.DateFieldDefinition

Mgnl p
label

Date

Mgnl p
class

info.magnolia.ui.form.field.definition.CompositeFieldDefinition

Mgnl p
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.

fields

required

Node containing child fields.

<child field names>

required

Name of the child fields. You can use any simple field definition.

class

required

Field definition class of the child field.

<child field properties>

required/optional

Any properties the child field supports.

class

required

Definition class of the composite parent field. Use info.magnolia.ui.form.field.definition.CompositeFieldDefinition.

layout

optional, default is horizontal

Defines the layout of the child fields: horizontal or vertical.

transformerClass

optional, default is info.magnolia.ui.form.field.transformer.composite.CompositeTransformer

Custom property transformer definition.

Info
titleBest practice
Excerpt

When nesting composite fields, use the delegating transformer classes, DelegatingCompositeFieldTransformer or DelegatingMultiValueFieldTransformer, rather than the other available transformer classes.