- First commit to issue fork.
- π©π°Denmark ressa Copenhagen
Thank you so much @wombatbuddy for raising this issue back in February 2022.
I had been scouring the internet, for something so simple as how to insert fields in my Views Twig template file, with the replacement tokens listed under the "Replacement patterns" in a field (type "Custom text", machine name
nothing
) trying first with{{ title }}
and then{{ row[field.field_alias] }}
as recommended in the Twig template file, but it didn't work ... but then I finally found a solution here in this issue, and I am eternally grateful.Having a wrong solution in the Views Twig template files is not great, so perhaps this MR can get reviewed and committed before too long, and other documentation tasks handled in a follow up issue?
- πΊπΈUnited States smustgrave
Believe #34 and #35 still need to be addressed.
- π©π°Denmark ressa Copenhagen
Thanks for a fast response @smustgrave.
About #34: I think I found the instances, are there more?
$ grep -iR "row\[field.field_alias\]" . ./core/themes/stable9/templates/views/views-view-field.html.twig: * data = row[field.field_alias] ./core/modules/views/templates/views-view-field.html.twig: * data = row[field.field_alias]
About #35: The example doesn't work for me.
That's why I commented, that it would be great to at least share a working example, and then refine in a follow up issue. What do you think about that suggestion?
In its current state, the non-working example is a major stumbling block, for Drupal users who want to use Views fields in a Twig template ...