-1

Is it possible to get the value from the field inside the paragraph in the red rectangle. This code part is placed within a twig-template "field--block-content--field-example.html.twig"

{% for item in items %}
  {{ dd(item.content) }}
  {{ item.content }}
{% endfor %}

twig item.content print out

3
  • 1
    Does this answer your question? How do I get the raw field value in a twig template? If the screenshot shows item.content then entity (from the linked answer) == item.content['#paragraph']
    – Hudri
    Apr 28 at 14:27
  • Yes indeed, item.content['#paragraph'].field_is_custom_package.value is working.
    – Lance
    Apr 28 at 14:57
  • The suggested link is not completely answering my question. Without your comment the suggested link could not have resolved my question. Now I understand that entity can be seen as item.content['#paragraph'].
    – Lance
    Apr 28 at 15:11
0

To get the raw value from an entity:

{{ entity.field_example.value }}

Where entity can be seen as item.content['#paragraph']

In my case:

item.content['#paragraph'].field_is_custom_package.value

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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