Instead of adding a list item or a value of a map entry you can include a file.

Use the Magnolia !include directive to add a reusable YAML chunk. Include a fragment on a sub-level of your definition. Reference the file you include by its resource path starting with /<module-name>/.

form:
  label: Example page properties
  tabs:
    - name: tabText
      label: Texts and categories
      fields:
        - name: title
          class: info.magnolia.ui.form.field.definition.TextFieldDefinition
          label: Title and categories
          i18n: true
        # an include within a list, here adding a field
        - !include /documentation-examples-templates/includes/categorization-field.yaml
# an include within a map, here adding a tab
actions: !include /documentation-examples-templates/includes/default-actions-block.yaml
   

The !include directive is Magnolia specific. The ! is a special character in YAML for a non-specific tag, see http://www.yaml.org/refcard.html

If you have created the includable fragment after the creation of the file which includes it, save the latter again to force the YAML parser to properly register the definition. /<module-name>/includes is the recommended directory for YAML fragment files. Avoid adding the YAML fragment files into the following directories: apps, blocks, decorationsdialogs, i18nmessageViewsrenderers, templates and virtualUriMappings.

(warning) With Magnolia 5.5.6+, the !include directive has been extended to provide more functionalities. (See YAML inherit and include).

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels