In Drupal 8.4.4 I have a "Living Things" taxonomy vocabulary. One field on the terms in the vocabulary is "Most Common Name", with machine name field_most_common_name
. On my "Animalia" term its value would be "Animal".
In Views, I have a "Taxon Media" view which lists media related to the taxonomy term. I display it in a block on the taxonomy term's pages themselves (not on nodes). In the view I group media by another field, "Primary Taxon", which is a reference to the term. It prints on the page as the grouping heading (e.g. "Animalia").
How can I print the value of my "Most Common Name" field next to that title? i.e. "Animalia Animal".
I have made a template, views-view-grouping--taxon-media.html.twig
, cloned from the one in the Classy template, tested that works, then added the 4th line and tried a few other things such as content.field_most_common_name
, but cannot get the field's value to display:
<div class="view-grouping">
<div class="view-grouping-header">
{{ title }}
{{ field_most_common_name }}
</div>
<div class="view-grouping-content">{{ content }}</div>
</div>