In views-view-fields--myview.html.twig I can print a views fully formatted/rewritten field with a variable like: {{ fields.field_my_view_field.content }}.

I am wondering if there is some way to print fields in the same fashion in the parent view template: views-view--myview.html.twig. This would require having access to these variables with the sub items (row) of the {{ rows }} variable.

Is this possible? And if so, what is the correct syntax to access?

  • Have you tried to dump {{ rows }}? Is it an array that you can simply loop through?
    – leymannx
    May 7, 2022 at 6:41

1 Answer 1


You say that outputting the variables the template is supposed to be outputting is very powerful. Interesting, I would say this is the (only) correct way to use this template. In special cases it might be necessary to access field raw values, for example to add CSS classes to divs you put into the template, wrapping HTML markup around the content variables. The real purpose of this template.


If you want to control the rendering from the main View level then use a custom style plugin. Then you don't need to use the mentioned Views field templates. You can build a structure entirely from scratch rendering the fields as you want.

See Views style plugins.

  • (I removed the noise from the question.)
    – leymannx
    May 7, 2022 at 6:48

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.