Obtaining pageLink path in SPA

135 views
Skip to first unread message

Michael Haufe

unread,
Mar 3, 2021, 12:27:25 PM3/3/21
to Magnolia User Mailing List
I came across something I thought would be trivial but seems poorly documented.

In the SPA demo project I attempted to create a PageLink component to simply link to a chosen page. I do not see a way to convert the UUID to a path name so that it's usable. I must be missing something simple...

The dialog:

```
label: Page Link
form:
  properties:
    target:
      label: Choose Page
      $type: pageLinkField
      identifierToPathConverter:
        class: info.magnolia.dam.app.assets.field.translator.AssetCompositeIdKeyTranslator
    text:
      label: Label
      $type: textField
      i18n: true
```

After linking to the homepage the json result for the component is:

```
{
  @id: "6d2a9522-beac-4416-a0e1-d6049cad8d2f"
  @name: "03"
  @nodeType: "mgnl:component"
  @nodes: []
  @path: "/react-minimal/contact0/main/03"
  mgnl:created: "2021-03-03T09:58:01.911-06:00"
  mgnl:lastModified: "2021-03-03T09:58:01.911-06:00"
  mgnl:template: "spa-lm:components/pageLink"
  target: "066761ae-f69b-4029-9900-496259837d2d"
  text: "Home"
}
```

I was hoping to get the path reflected in the dialog. What am I missing? `identifierToPathConverter` seems pointless.

Marc Johnen

unread,
Mar 3, 2021, 12:50:15 PM3/3/21
to Magnolia User Mailing List
You need Resolver, something like

  - name: target
    propertyName: target
    referenceResolver:
      class: info.magnolia.rest.reference.jcr.JcrReferenceResolverDefinition
      targetWorkspace: website
      generateLink: true

in your endpoint definition.

--
You received this message because you are subscribed to the Google Groups "Magnolia User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to user-list+...@magnolia-cms.com.
To view this discussion on the web, visit https://groups.google.com/a/magnolia-cms.com/d/msgid/user-list/580bdb1a-77c7-4cad-a2fc-41194a0bc820n%40magnolia-cms.com.

Michael Haufe

unread,
Mar 4, 2021, 8:59:53 AM3/4/21
to Magnolia User Mailing List, marc....@neofonie.de
On Wednesday, March 3, 2021 at 11:50:15 AM UTC-6 marc....@neofonie.de wrote:
You need Resolver, something like

  - name: target
    propertyName: target
    referenceResolver:
      class: info.magnolia.rest.reference.jcr.JcrReferenceResolverDefinition
      targetWorkspace: website
      generateLink: true

in your endpoint definition.


This makes far more sense now.  
Reply all
Reply to author
Forward
0 new messages