Reputation: 5
I have a class list_article
with an attribute of type Relation Objects
to retrieve article objects. What is the simplest way to get this related object in a Twig template?
Upvotes: 0
Views: 89
Reputation: 2310
By default, you can't. The best you can do in Twig is to retreive the list of related content IDs with ez_field_value(content, 'my_relation_field').destinationContentIds
.
To fetch the content objects themselves, your best bet would be to use a subrequest to execute a controller which loads the related content and then renders it in a separate Twig template.
Upvotes: 1