Magnolia 6.0 reached end of life on June 26, 2019. This branch is no longer supported, see End-of-life policy.

Page tree
Skip to end of metadata
Go to start of metadata

The collapsible composite field is provided by the Content Editor module which is an EE Pro module.

CollapsibleCompositeFieldDefinition extends the composite field to add a clickable header that toggles the visibility of the field's content. Editors can click the header to display and hide the subfields. 

Like the composite field, the collapsible composite field defines a complex field that is composed of multiple simple fields. 

class: info.magnolia.editor.app.field.CollapsibleCompositeFieldDefinition

fieldType: collapsibleComposite

The collapsible composite field is useful in content editor apps like the Stories app as shown below.

Collapsed:

Expanded:

It can also be used in a standard dialog as well. Here is a collapsible composite field that consists of a text field and a date field:

Collapsible composite field properties

Simple collapsible composite field definition:

form:
  tabs:
    - name: tabExample
      fields:
        - name: event
          fieldType: collapsibleComposite
          label: Event
          fields:
            - name: title
              fieldType: text
              label: Title
            - name: date
              fieldType: date
              label: Date
Node nameValue

 form


 tabs


 tabExample


 fields


 event


 fields


 title


 fieldType

text

 label

Title

 date


 fieldType

date

 label

Date

 fieldType

collapsibleComposite

 label

Event

See Referencing fields for further information.

You can use common field properties and the following properties in a collapsible composite field definition:

Composite field properties.

<collapsible 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.

Properties specific to the collapsible composite field.


class

required

Definition class of the composite parent field. Use info.magnolia.editor.app.field.CollapsibleCompositeFieldDefinition.

collapsed

optionaldefault is false

Defines whether the field should be collapsed initially.

transformerClass

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

Custom property transformer definition.

layout

optionaldefault is vertical

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

(warning) In custom content editor apps, this property must remain set to vertical.



Best practice

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