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

The option list data source provides a static list of configured options. By default, it does not provide any component implementation itself other than the one required by select fields.

The option list data source is part of the Magnolia 6 UI framework. The fully qualified class name is info.magnolia.ui.datasource.optionlist.OptionListDefinition.

If you work with the Magnolia 5 UI framework, see Content connector instead.

The option list data source replaces the options configuration for select fields in Magnolia 5 UI. Previously, the option definition list was a core part of select field definition. This made it harder to convey the select fields that populate an item list in a more complex way than a predefined list of options (e.g. a database table or JCR workspace).

With the option list data source in Magnolia 6 UI, select fields can now specify the back-end configuration from which selection items are fetched. Preconfigured options then become concrete examples of such a data source, which only provides a predefined list of elements.

Example definition

datasource:
  $type: optionListDatasource
  options:
    - name: zambia
      value: zambia
    - name: argentina
      value: argentina
    - name: andorra
      value: andorra
    - name: switzerland
      value: switzerland
    - name: italy
      value: italy

List of properties

class or $type

required

Use info.magnolia.ui.datasource.optionlist.OptionListDefinition for the class property or optionListDatasource for the $type shortcut.

options

required

Parent node for selectable options. See OptionDefinition for more information.

value

required

Value saved to the repository when selected.

name

optionaldefault is the parent node name

Name of the node where the selected value is stored. If no name is defined, the parent node name will be used instead.

label

optional

Option label displayed to the user.

iconSrc

optional

Displays an image next to the option. Value is a path to the image.

name

optional, default is optionlist

Name of the data source.

sortable

optional, default is false

When set to true, the list of options can be sorted.

Data source components

Module component mappings can be defined in the context of the current data source (a component section should have an id in the form of <id>datasource-<ds-name></id>, where <ds-name> is configured in the definition).

TypeImplementationDescription
info.magnolia.ui.field.SelectFieldSupportinfo.magnolia.ui.datasource.optionlist.OptionSelectFieldSupport

Provides delegates required by select fields.

Component mappings in module descriptor
<components>
  <id>datasource-optionlist</id>
  <component>
    <type>info.magnolia.ui.field.SelectFieldSupport</type>
    <implementation>info.magnolia.ui.datasource.optionlist.OptionSelectFieldSupport</implementation>
  </component>
</components>
  • No labels