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

LinkFieldDefinition renders a text field and a browse button that allows you to select an item from any data source. It extends ComboBoxFieldDefinition.

The link field is used to select targets inside Magnolia (for example, an asset to render an image or a page to tease) where it stores a reference to the selected item. Magnolia provides three preconfigured link field definitions:

  • DamLinkFieldDefinition: links to an asset (damLinkField).
  • PageLinkFieldDefinition: links to a page (pageLinkField).
  • JsonLinkFieldDefinition: links to a JSON node (jsonLinkField).

This link field definition is part of the Magnolia 6 UI framework. The fully qualified class name is info.magnolia.ui.field.LinkFieldDefinition.

If you work with the Magnolia 5 UI framework, see Link field for Magnolia 5 UI instead.

Example link field definition

link:
  label: Select image
  $type: linkField
  datasource:
    $type: jcrDatasource
    workspace: contacts
  chooserId: myModule:chooser

Link field properties

chooserId

optional, default is ui-framework-jcr:chooser

Unique identifier for the chooser dialog. If none is specified, the JCR chooser will be used by default.

buttonSelectNewLabel

optional, default is translated buttons.select.new key

Button label before the target node is selected. The value is i18n-able.

buttonSelectOtherLabel

optional, default is translated buttons.select.another key

Button label after the target node is selected. The value is i18n-able.

editable

optional, default is true

When false, the text field displaying the link cannot be edited once a target is selected.

preview

optional

Renders a preview of the selected content. The preview component typically displays an image thumbnail and some metadata.

implementationClass

required

Any class that implements the info.magnolia.ui.preview.ItemPreviewComponent interface. Examples:

  • info.magnolia.contacts.app.ContactPreview
  • info.magnolia.rest.ui.field.linkfield.JsonItemPreviewComponent

See also combobox field, select field, and common field properties.

  • No labels