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 preconfigured multi field definitions:

  • JcrMultiValueFieldDefinition: allows you to enter multiple values of a single type to be stored as an array in a single JCR property (jcrMultiValueField).

  • JcrMultiFieldDefinition: allows you to create multiple simple or complex JCR fields (jcrMultiField).

  • JsonMultiFieldDefinition: allows you to create multiple simple or complex JSON fields (jsonMultiField).

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

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

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

Multi field properties

$type

required

  • jcrMultiValueField allows you to enter multiple values of a single type to be stored as an array in a single JCR property.
  • jcrMultiField allows you to create multiple simple or complex JCR fields.
  • jsonMultiField allows you to create multiple simple or complex JSON fields.

field

required

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

entryResolution

optional, default is

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

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

orderHandler

optional, default is

  • MultiValuePropertyOrderHandler for JcrMultiValueFieldDefinition
  • DefaultJcrNodeOrderHandler for JcrMultiFieldDefinition

Implementation class that sorts nodes and ensures that the suffixes in index names correspond to the order in which they are stored.

canRemoveItems

optional, default is true for JcrMultiValueFieldDefinition and JcrMultiFieldDefinition

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

buttonSelectAddLabel

optional, default is translated buttons.add key

Button label for adding an item. The value is i18n-able.

buttonSelectRemoveLabel

optionaldefault is translated buttons.delete key

Button label for removing an item. The value is i18n-able.

See also Common field properties.

Example definitions

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

JCR multi field

From Magnolia 6.2.4, jcrChildNodeProvider is the item provider used by default in JcrMultiFieldDefinition.

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

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