Delivery API resolving jcrReference and assetReference within

25 views
Skip to first unread message

Christoph Damm

unread,
Sep 29, 2022, 6:42:14 AMSep 29
to Magnolia User Mailing List
Hello again,

I am looking for direction for the following use case:
Within a product app a user wants to select a folder from within the DAM containing images.
Over the delivery API I want to pass all off those asset links to my frontend in order to render those. So basically instead of having a multi field where user has to add specifically all images he wants to just select a folder and all assets of this folder should be rendered.

I'm struggling to get those references resolved though via the delivery API.
Image folder would be as such:

- name: imagesFolderReference
  propertyName: imagesFolder
  referenceResolver:
    class: info.magnolia.rest.reference.jcr.JcrReferenceResolverDefinition
    targetWorkspace: dam

However, how would I be able to resolve the asset references within those references? (as those are returned as nodes only of course)
Can the assetresolver somehow be "chained" to it? Or can/would I have to write an own resolver for that?

Thanks for ideas or pointing me into the right direction!

Regards,

Christoph

Mikaël Geljić

unread,
Sep 29, 2022, 11:25:46 AMSep 29
to Magnolia User-List
Hi Christoph,

This can likely be done with a custom ReferenceResolver implementation.

Similar to the JcrReferenceResolver, you would:
* inject the magnolia Context (Provider<Context>) to get a JCR dam session from,
* inject the AssetProviderRegistry to create an AssetReferenceResolver programmatically
* iterate over the folder's nodes and delegate to this resolver instance?

Hope that makes sense 🤞
Cheers,
Mika

--
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/CAGgPrdjjCV1BNQ1p%2B5VCs%3DdhSW3AmTf1Qc4wS3HM%3DNiK0KYJiw%40mail.gmail.com.

Reply all
Reply to author
Forward
0 new messages