Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

(warning) 5.4.4+ The link field allows you to choose items from any content app, included non-JCR apps. See Using a link field to choose an item from non JCR Content app.

Classclassinfo.magnolia.ui.form.field.definition.LinkFieldDefinition

...

Localtab Group
Localtab
activetrue
titleYAML file
Code Block
languagejs
form:
 tabs:
    - name: tabImage
      label: Image 
      fields:
        - name: image
          class: info.magnolia.ui.form.field.definition.LinkFieldDefinition
          targetWorkspace: dam
          appName: assets
          label: Select image
          identifierToPathConverter:
            class: info.magnolia.dam.app.assets.field.translator.AssetCompositeIdKeyTranslator
          contentPreviewDefinition:
            contentPreviewClass: info.magnolia.dam.app.ui.field.DamFilePreviewComponent
Localtab
titleJCR node
Advanced Tables - Table Plus
heading0
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
 
Node nameValue

Mgnl n
form

 


Mgnl n
tabs

 


Mgnl n
tabImage

 


Mgnl n
fields

 


Mgnl n
image

 


Mgnl n
identifierToPathConverter

 

Mgnl p
class

info.magnolia.dam.app.assets.field.translator.AssetCompositeIdKeyTranslator

Mgnl n
contentPreviewDefinition

 


Mgnl p
contentPreviewClass

info.magnolia.dam.app.ui.field.DamFilePreviewComponent

Mgnl p
appName

contacts

Mgnl p
class

info.magnolia.ui.form.field.definition.LinkFieldDefinition

Mgnl p
targetWorkspace

dam

Mgnl p
label

Select image

Mgnl p
label

Image 


You can use common field properties and the following properties in a link field definition:

...

Depending on the implementation of the content app, the ItemId may be a String or a more complex Object. A well-known ItemId is 

Javadoc
0info.magnolia.ui.vaadin.integration.jcr.JcrItemId
. The callback properly handles JcrItemId, and if it is another type, String.valueOf(chosenValue) is saved to the link field.

Code Pro
collapseTypeExpand
languagejava
titleClick to expand to see LinkFieldFactory#createChooseDialogCallback
collapsetrue
sections%%(protected ChooseDialogCallback)%% -
urlhttps://git.magnolia-cms.com/projects/PLATFORM/repos/ui.pub/browse/magnolia-ui-form/src/main/java/info/magnolia/ui/form/field/factory/LinkFieldFactory.java?at=master&raw
 

When using LinkField with  JCR-agnostic target apps that use complex ItemIds that extend Object, override the public String toString()  method on the implementation of the itemId.

...