Page History
...
Info | ||
---|---|---|
| ||
|
Switchable field and complex nesting
The example configuration below shows the use of the delegating field transformers for a complex nesting scenario where, at the top level, the user has a two-option switch:
The Composite option opens into a composite field with two text fields:
The Multi option opens into a multi field that allows the user to add individual text fields (three are shown):
The field's YAML configuration:
Code Block | ||
---|---|---|
| ||
switchComposite:
class: info.magnolia.ui.form.field.definition.SwitchableFieldDefinition
label: Option Switch
selectionType: radio
transformerClass: info.magnolia.ui.form.field.transformer.composite.DelegatingCompositeFieldTransformer
type: String
options:
switchInnerComposite:
label: Composite
value: switchInnerComposite
switchInnerMulti:
label: Multi
value: switchInnerMulti
fields:
switchInnerComposite:
class: info.magnolia.ui.form.field.definition.CompositeFieldDefinition
label: Composite Field
transformerClass: info.magnolia.ui.form.field.transformer.composite.DelegatingCompositeFieldTransformer
fields:
text1:
class: info.magnolia.ui.form.field.definition.TextFieldDefinition
label: Text Field 1
type: String
text2:
class: info.magnolia.ui.form.field.definition.TextFieldDefinition
label: Text Field 2
type: String
switchInnerMulti:
class: info.magnolia.ui.form.field.definition.MultiValueFieldDefinition
label: Multi Field
required: false
transformerClass: info.magnolia.ui.form.field.transformer.multi.DelegatingMultiValueFieldTransformer
field:
class: info.magnolia.ui.form.field.definition.MultiValueFieldDefinition
name: newSubMultiple
required: false
transformerClass: info.magnolia.ui.form.field.transformer.multi.DelegatingMultiValueFieldTransformer
field:
class: info.magnolia.ui.form.field.definition.TextFieldDefinition
name: nameProperty
type: String transformer classes, DelegatingCompositeFieldTransformer or DelegatingMultiValueFieldTransformer, rather than the other available transformer classes. |