Vote count:
0
I'm building a themed view in Drupal 8 using twig. I'd like to use twig filters on the row.content variable in the views-view-unformatted.html.twig template.
It seems that row.content is an array so twig's string manipulation doesn't work. However, it prints onto the page as a string (view is just a list of taxonomy terms).
What I'd like to do is slugify the output so taxonomy terms with spaces can have valid hrefs. See the replace filter in the code below.
<ul class="nav nav-tabs" role="tablist">
{% for row in rows %}
<li role="presentation" class="{{loop.first ? 'active' : ''}}">
<a href="#{{row.content | replace({" ", "-"})}}" aria-controls="{{row.content}}" role="tab" data-toggle="tab">{{row.content}}</a>
</li>
{% endfor %}
</ul>
This will just output <a href="#">. Does anyone know how to access the raw text value that is output during twigs interpolation?
Thanks!
asked 44 secs ago
Applying twig filters in Drupal 8 Views Template
Aucun commentaire:
Enregistrer un commentaire