Access fields in views-view Twig template I'm trying to loop through rows in a views-view template, but I can't seem to kint or dump anything out to help me in doing so.

I've tried following various other answers, such as:


In Drupal 8 view.html.twig file how do I access the view content such as individual field title and/or field content?
How to get each field value in views-views-unformatted--view-machine-name.html.twig?


Again, without any success.

Usually I'd create a views-view-fields template, and access my fields via fields.title.content for example. I need to loop through them via the views-view template, as I'm needing to do some checks, taking into account values of some of the previous row's fields.

How can I access a rows fields when looping through rows in my views-view template?
In your case you should be using views-view-fields.html.twig instead of views-view-unformatted.html.twig file.

Views fields template will iterate on all rows of result. Your views-view-fields.html.twig should contain below code -

&lt;div&gt;
  &lt;a class="view-row" href="{{variable-to-print-path }}"&gt;
   &lt;img src="{{ image-path }}"&gt;
   &lt;h3&gt;{{ fields.title.content&lt;/h3&gt;
  &lt;/a&gt;
&lt;/div&gt;


You can check the fields array by using kint function like - {{ kint(fields) }}

Check for image path and anchor path variable from output of kint function.

If you want to do this in views-view-unformatted.html.twig, then you can access the field values like below -

{% for row in rows %}
  {% set photo = file_url(row['content']['#row']._entity.field_page_photo.entity.fileuri) %}          
  &lt;li&gt;&lt;img src={{ photo }} class="img-responsive img-circle"&gt;&lt;/li&gt;
{% endfor %}