I'm using Drupal 8.5.4 and Bootstrap Paragraphs. I have a custom module foo and a custom paragraph type bar defined within. In the template for bar, I use kint to inspect the content of the variable. It turns out it has 17 properties, and none of them are the value of the field. The first 14 of them are in core/lib/Drupal/Core/Field, L#89-102. The last 3 are 0, #cache, and weight.

Digging into the object, I found the field value in content.bar.0['#context'].value. Obviously using this method to access a simple field value is janky as hell, and I would prefer not to have to do this every time.

Two questions:

  1. Is there a simpler way to access the field value? I don't mind using a twig filter if need be
  2. Is there a way to configure my paragraph types to pass the context to the template, rather than all of the field data?
  • You could preprocess the paragraph entity for the variable
    – Kevin
    Nov 22, 2018 at 0:55

1 Answer 1


You are referring to paragraph--bar.html.twig? Then this depends on what you want to do with the value.

Render the field value:

{{ content.field_example }}

Write code with it:

{% if paragraph.field_example.value == 'foo' %}
  <p>The field value is "foo".</p>
{% endif %}

See this blog post for node.html.twig, which applies here as well, only that the entity is paragraph. instead of node.: https://www.md-systems.ch/de/blog/techblog/2017/02/20/twig-and-entity-field-api-or-how-to-take-control-of-nodehtmltwig

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