I'm using drupal 8, in my template I created a file named views-view-unformatted--block-12.html.twig and this is it's content:

<div class="row list">
{% for row in rows %}
    set body = row.content['#row']._entity.get('body').value|striptags|render
    set title = row.content['#row']._entity.get('title').value
      <div class="col-md-3">
        <div class="promotion-slider-item">
          <p class="mb-0">
            <img alt="Title" data-src="/themes/porto/img/abc/maxresdefault.png" class="lazy-load">
          <div class="inner">
            <p class="title mb-1">{{ title }}</p>
            <div class="desc">{{ body|length > 70 ? body|slice(0, 70)|raw ~ '...' : body|raw }}</div>
            <a href="/node/{{row.content['#row']._entity.get('nid').value}}" title="{{row.content['#row']._entity.get('title').value}}" class="btn-read-more"><span class="">Read more</span></a>
          </div> <!-- end .inner -->
        </div> <!-- end .promotion-slider-item -->
    </div> <!-- end .col -->
{% endfor %}

I try to dump(row.field_images) but null and dump(file_url(row.content['#row']._entity.get('field_images').value['0']['target_id'])) but url is /id_sample. How do I fix it?

1 Answer 1


I did with this code row.content['#row']._entity.YOUR_FIELD_NAME.entity.fileuri

Your Answer

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

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