I have a content type article which have a field repeatable "related content"
I use a field twig where I have this loop
{% for item in items %}
{{ item.content }}
{% endfor %}
It works very well : it displays title of the article and a link to the content.
I would like also to display some subfields associated with this content but I'm not successful.
I’ve tried things like :
{{ item.content.field_date_mise_a_jour_article.value }}
but obviously it doesn’t work. item.content
only contains url and title.
How can I do that ?
In node--article.html.twig
, i can access the related content subfield like that :
{{ node.field_suggestion_articles.entity.field_date_mise_a_jour_article.value }}
How can I do the same in
field--field-suggestion-articles.html.twig
{% set node = element['#object'] %}
, and use the node the same way as in a node template.{{ item.content['#node'].field_name.value }}