The 5.7 branch of Magnolia reached End-of-Life on December 31, 2023, as specified in our End-of-life policy. This means the 5.7 branch is no longer maintained or supported. Please upgrade to the latest Magnolia release. By upgrading, you will get the latest release of Magnolia featuring significant improvements to the author and developer experience. For a successful upgrade, please consult our Magnolia 6.2 documentation. If you need help, please contact info@magnolia-cms.com.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

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.

  • No labels