0

I'm trying to output paragraph field values in a sample paragraph template, but it does not work. I created a twig template in paragraph/paragraph--article--default.html.twig

I have a field called field_action and I tried:

{% block paragraph %}
    <div{{ attributes.addClass(classes) }}>
      {% block content %}
        {{content.field_action}}
        {{content.field_action.value}}

      {% endblock %}
    </div>
{% endblock paragraph %}

Nothing happens.

If I write {{content}} everything is fine, but I would like to customize output.

1
  • 1
    Is the block content necessary? Otherwise this should work fine.
    – Kevin
    Jan 17, 2019 at 16:12

1 Answer 1

2

To print out single fields I usually use, {{ paragraph.field_action.value }}. That should also work for you.

In the case of an entity reference field, you need to use {{ paragraph.field_action.entity.field.value }}.

0

Your Answer

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

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