0

I'm simply trying to render a Paragraph field from my content type in a view template. It's insanely difficult! I have the field setup to display the rendered entity, but how do I set it up in my template? Below 'field_question' works fine but 'field_faq_answer', which is the Paragraph field, doesn't render anything.

{% for row in rows %}
  {% set question = row.content['#row']._entity.field_question.value %}
  {% set answer = row.content['#row']._entity.field_faq_answer %}

  {% include 'component--accordion-item.html.twig' with {
    'title': question,
    'uid': random(),
    'content': answer
  }
%}
{% endfor %}
0

1 Answer 1

0

To render an entity field use the View filter of the module Twig Tweak:

{{ row.content['#row']._entity.field_faq_answer|view }}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.