...
In component template definition?
Put the same reference resolver configuration in the component template definition?
/components/tourCarousel.yaml
Code Block |
---|
title: Tour Carousel
dialog: travel:components/tourCarousel
references:
tours:
propertyName: tours
referenceResolver:
$type: JcrReferenceResolver
targetWorkspace: tours
# Handle subproperties of tours:
tourTypes:
propertyName: tourTypes
referenceResolver:
$type: JcrReferenceResolver
targetWorkspace: categories
image:
propertyName: image
referenceResolver:
$type: AssetReferenceResolver
includeAssetMetadata: false
|
As
...
an optional GraphQL fragment?
GraphQL was designed to handle this kind of querying/referencing.
...
/components/tourCarousel.graphql
(The dialog is very simple, it is basically a multiselect for "tours".)
Code Block |
---|
{
tours: Tours{ # Need a hint to know its type
name
duration
image: Asset{
link
renditions(renditionNames: "1600") {
renditionName
link
}
}
tourTypes: Category{ # Need a hint to know its type
displayName
icon{
link
}
}
}
} |
As an optional JSON fragment?
If developer supplies a JSON file - it overrides the default response. Maybe use JS templating??
/components/tourCarousel.json (JUST A SKETCH!)
Code Block |
---|
{ "tours": [ { "name": `${name}`, "duration": `${duration}`, "image": { "link": `${image.link}`, "rendition": `${image.rendition["1600"]}`, }, "tourTypes": [ { "displayName": `${displayName}`, "icon": `${icon.link}` } ] } ] } |