Get referenced node fields in twig

I’m doing a project at work that uses Drupal for the backend. I created a paragraph type called Collection-band-3 that has a field named “Content reference” and is an Entity Reference referred to a content type named Person that has a series of fields. I want to get and print the person connected to that reference field
I am doing this :

{% block paragraph %}
  <div class="co-collection-band-3">
    <h2> {{paragraph.field_title.value|raw}} </h2>
    <p> {{paragraph.field_body.value|raw}} </p>
  </div>
  <p> {{content.field_content_reference|raw}}
    {% for person in content.field_content_reference %}
    {{  person.field_title }}
    {% endfor %}
  </p>
{% endblock paragraph %}

Can I get some help?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *