Hi,
I have figured a way to access views views row fields inside views-view-unformatted.html.twig
{% for row in rows %}
{{ row.content['#view'].style_plugin.render_tokens[ loop.index0 ]['{{ YOUR_FIELD_NAME }}'] }}
{% endfor %}
I need to know what do you think of this method, is it cool or bad.
The reason why I avoid using views-view-fields.html.twig is that I use lots of views with many displays, and I don't wan't to use lots of template overrides.
Comments
Comment #2
lendudeViews is in Drupal core now. Moving this to the right queue.
Comment #5
cosolom commentedPlease, note. If you want modify row - you need use views-view-fields.html.twig (for fields show format) template instead of views-view-unformatted.html.twig.
Comment #8
netw3rker commentedThat's an interesting way to handle this, and might be very useful for things like combining multiple fields together. I had a similar requirement and wound up with something relatively similar:
the 'view' variable isn't documented, but exists, so is useful here, and is a little more direct than using row.content['#view']
Comment #14
cilefen commentedI am closing this support request because there have been no recent comments.
The Drupal Core issue queue is not the ideal place for support requests. Consider other sources of support.