I have a views-view-unformatted.html.twig template working fine where I can print fields from a view of nodes.
Example: having i = 3, print row number 3 title
{{ rows[i]['content']['#row']._entity.title.0.value }}
This view has also a working relationship with flag. I see it working in the view preview.
How can I print the flag link inside views-view-unformatted.html.twig?
{{ rows[i]['content']['#row']._entity.flag_field_name.value }}
? Replaceflag_field_name
with the actual field name of the flag field.{{ rows[i]['content']['#row']._entity.link_flag.value }}
is not producing anything.{{ dump( rows[i]['content']['#row']._entity) }}
that should list all the fields in the render array, then you can drill into the fields, and the link_flag should be listed there. Fields are usually prefixed withfield_
. Maybe paste the output of the dump in the question if it's not too long.field_
. I am using the flag module in 1 of my projects. I will try to replicate this case in my project and post when I find something.protected values -> array(10)
. I tried to reproduce this but I also find it more difficult to get flag values. Usually I make view blocks and render them in twig instead of using the view-unformatted template, and I use twig block template overrides to render the fields / content in the view. I can also suggest asking for a support request in the flag project page on Drupal.org, maybe someone can suggest another option there.