0

I am trying to render image in custom field.html.twig template but following snippet not working:

    {% for item in items %}
      {% if not loop.first %}
        <div class="image-gallery-image"><img src="{{ item.content['#item'].entity.uri.value|image_style('thumbnail')|replace(' ','') }}"></div>
      {% endif %}
    {% endfor %}

but when i add {{ item.content['#item'].entity.uri.value|image_style('thumbnail')|replace(' ','') }} before img tag, then both uri value + img tag rendered.

 {% for item in items %}
  {% if not loop.first %}
     {{ item.content['#item'].entity.uri.value|image_style('thumbnail')|replace(' ','') }}
    <div class="image-gallery-image"><img src="{{ item.content['#item'].entity.uri.value|image_style('thumbnail')|replace(' ','') }}"></div>
  {% endif %}
 {% endfor %}

What can be the possible issue that its not rendering in simple case?

Your Answer

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

Browse other questions tagged or ask your own question.