Magnolia 5.7 reached extended end of life on May 31, 2022. Support for this branch is limited, see End-of-life policy. Please note that to cover the extra maintenance effort, this EEoL period is a paid extension in the life of the branch. Customers who opt for the extended maintenance will need a new license key to run future versions of Magnolia 5.7. If you have any questions or to subscribe to the extended maintenance, please get in touch with your local contact at Magnolia.
This page describes two ways in which you may define the type of a field in a form .
When creating a form for a dialog's tab, you usually want it to contain some fields. The fields are the core building blocks of the form's functionality for user tasks such as entering a text and sending it to a server after the user hits the form's submit button.
Fields are defined using a field definition, which must contain – at minimum – a property telling Magnolia what type of field it should render in the dialog.
Using the class
property
Until the release of Magnolia 5.7, the only way to specify the type of a field was to state its fully qualified class name. For example, to create a simple text field named title
in a dialog's tab called tabText
you had to create the following configuration:
form: tabs: - name: tabText fields: - name: title class: info.magnolia.ui.form.field.definition.TextFieldDefinition
Using the fieldType
property and short field names
For legibility, ease of development, and to make field names easier to remember, with Magnolia 5.7 we've introduced the fieldType
property.
- For the
fieldType
property you no longer need to specify the field type using a fully qualified class name. Just provide the field's name as the value of thefieldType
property.If your project uses the
class
property in too many places, you can still continue usingclass
. The feature is backwards compatible. - We have streamlined the definition names by making them shorter. The Short field names list below on this page shows which fields are affected.
Applied to the above example the configuration can now be as simple as this:
form: tabs: - name: tabText fields: - name: title fieldType: text
To verify that you use correct short field names, look in the Definitions app :
Relevance for custom fields extending or decorating Magnolia fields
Please note that the new short field naming affects:
- The origin of the definition. The fields defined previously as JCR nodes under
/modules/<module-name>/fieldTypes
folders are now defined from YAML files.
See the following example showing the definition ofdamUploadField
in Magnolia 5.6.6 and the correspondingdamUpload
definition in Magnolia 5.7:
- The file names. If a field was previously defined in a YAML file, the file's name has changed to the new short name. See for example the definition of the Expanding text field:
/content-editor/fieldTypes/expandingTextField.yaml
(in Magnolia 5.6.6)/content-editor/fieldTypes/expandingText.yaml
(in Magnolia 5.7)
If you have custom fields which reuse an existing Magnolia configuration via YAML include, YAML inherit, JCR extends or by decoration, your custom definition may be broken now if you reference a field which has changed its name.
Short field names
Old name | New name | Since |
---|---|---|
UI module | ||
basicTextCodeField
| code | 5.7 |
basicUploadField | basicUpload | 5.7 |
checkBoxField | checkbox | 5.7 |
compositeField | composite | 5.7 |
dateField | date | 5.7 |
hiddenField | hidden | 5.7 |
linkField | link | 5.7 |
linkFieldSelect | linkFieldSelection | 5.7 |
multiField | multiValue | 5.7 |
nodeTypeField | nodeTypeSelect | 5.7 |
optionsField | optionGroup | 5.7 |
passwordField | password | 5.7 |
selectField | select | 5.7 |
staticField | static | 5.7 |
switchableField | switchable | 5.7 |
textArea | richText | 5.7 |
textField | text | 5.7 |
twinColSelectField | twinColSelect | 5.7 |
workbenchField | workbench | 5.7 |
DAM module | ||
damUploadField | damUpload | 5.7 |
damWorkbenchField | damWorkbench | 5.7 |
Content tags module | ||
tagField | tag | 5.7 |
taggingAwareDependenciesField | taggingAwareDependencies | 5.7 |
Content dependencies module | ||
referenceField | dependencies | 5.7 |
Content editor module | ||
articleBlockPicker | blockPicker | 5.7 |
collapsibleCompositeField | collapsibleComposite | 5.7 |
expandingLinkField | expandingLink | 5.7 |
expandingTextField | expandingText | 5.7 |
peekField | peek | 5.7 |
placeholderText | placeholderText | 5.7 |
refreshableTextField | refreshableText | 5.7 |