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

MultiFieldDefinition renders multiple field sets (for example, three sets of two text fields). Magnolia provides three implementations of this field type:

  • JcrMultiFieldDefinition: default configuration for JCR multi fields.
  • JcrMultiValueFieldDefinition: default configuration for JCR multi-value fields.
  • JsonMultiFieldDefinition: default configuration for JSON multi fields.

All three implementations extend MultiFieldDefinition.

These multi field definitions are part of the Magnolia 6 UI framework. Their fully qualified class names are:

  • info.magnolia.ui.field.JcrMultiFieldDefinition
  • info.magnolia.ui.field.JcrMultiValueFieldDefinition
  • info.magnolia.rest.ui.field.JsonMultiFieldDefinition

In the Magnolia 5 UI framework, the field functionally parallel to the JCR fields is Multivalue field. There is no corresponding 5 UI implementation for the JSON multi field.

Multi field properties

field

required

Node containing multi field definition, a field type (for example, compositeField) and the individual field items.

entryResolution

optional, default is

  • MultiFieldEntryResolution for JcrMultiFieldDefinition
  • ByMultiValueProperties for JcrMultiValueFieldDefinition
  • JsonMultiFieldEntryResolver for JsonMultiFieldDefinition

Implementation class that defines how the child entries of a multi field should be resolved.

orderHandler

optional, default is

  • DefaultJcrNodeOrderHandler for JcrMultiFieldDefinition
  • MultiValuePropertyOrderHandler for JcrMultiValueFieldDefinition

Implementation class that sorts nodes and ensures that their names correspond to the indices.

canRemoveItems

optional, default is true for JcrMultiFieldDefinition and JcrMultiValueFieldDefinition

When false, the items of a multi field cannot be removed from a dialog.

See also Common field properties.

Example definitions

JCR multi field

multi:
  label: Addresses
  i18n: true
  $type: jcrMultiField
  itemProvider:
    $type: currentItemProvider
  field:
    $type: compositeField
    properties:
      street:
        label: Street name
        $type: textField
      city:
        label: City name
        i18n: true
        $type: textField
      zip:
        label: ZIP code
        $type: textField

JCR multi-value field

assignedSegments:
  $type: jcrMultiValueField
  field:
    $type: comboBoxField
    converterClass: info.magnolia.ui.editor.converter.JcrNodeToWorkspaceAndIdConverter
    datasource:
      $type: jcrDatasource
      workspace: segments
      describeByProperty: jcrName
      allowedNodeTypes:
        - mgnl:segment

JSON multi field

This definition renders two JSON composite fields, each consisting of two text fields.

stationboard:
  label: Station Board
  $type: jsonMultiField
  itemProvider:
    $type: jsonMultiFieldProvider
  field:
    $type: jsonCompositeField
    idPropertyName: name
    properties:
      name:
        label: name
        $type: textField
        readOnly: true
      to:
        label: to
        $type: textField
        readOnly: true

For full REST client and app definitions, see the transportation.yaml and stations.yaml files in the declarative-rest-ui-demo folder of our rest-client-ui repository.

  • No labels