Hello,
Problem/Motivation
I added a Media SVG file in a taxonomy term.
I built a TWIG file to display it as a 'regular' node content field with this code:
<div class="item">
<div class="icon-svg">{{ content.field_icon_svg }}</div>
<div class="tag">{{ name }}</div>
</div>That works fine, even in a custom view mode.
When building a node TWIG, I only can display the terme 'name'.
No way to display the SVG icon.
How to proceed?
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | Screen Shot 2024-05-22 at 10.41.31 AM.png | 629.2 KB | jwilson3 |
| #3 | Screen Shot 2024-05-22 at 10.41.18 AM.png | 560.71 KB | jwilson3 |
Comments
Comment #2
webmestre commentedComment #3
jwilson3I had to read this a few times to understand, and as far as I can tell, it appears your question might be confusing "node TWIG" for "Taxonomy TWIG"? since "term name" is for taxonomies and "node title" is for nodes.
Anyway, I've tested both adding a field_svg_icon to a Taxonomy vocabulary as well as a Node type, and the custom templates work the same way in both cases.
My template overrides:
Both work fine:
My only suggestions are to ensure you've enabled the field_svg_icon in the correct display (eg Default, Full content, Teaser) on the "Manage Display" tab of your Content type and Taxonomy term config screens.
I'm afraid I'd need more clear example of your configuration to help troubleshoot this any further. Marking postponed.
Comment #4
jwilson32 years old support request has been addressed/answered and no feedback from OP. Closing this as cannot reproduce.