I cannot get this to render out. This is what I get with {{ kint(paragraph.field_image.value) }}
.
If this makes any difference, the image is uploaded through a media entity browser widget.
How do I render an image from a Twig template?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityyou could just use {{ content.field_image }}
Here is an example of a template file from a paragraph
{%
set classes = [
'paragraph',
'paragraph--type--' ~ paragraph.bundle|clean_class,
view_mode ? 'paragraph--view-mode--' ~ view_mode|clean_class,
]
%}
{% block paragraph %}
<div{{ attributes.addClass(classes) }}>
{% block content %}
<div class="row collapse expanded mainsection">
<div class="large-12 columns">
<div class="row collapse">
<div class="large-12 columns">
{{ content.image }}
</div>
</div>
</div>
</div>
{% endblock %}
</div>
{% endblock paragraph %}
Notice that I only need to write {{ content.FIELDNAME }}
, if I wrap everything in a {% block content %}