I have custom field that returns a value for an icon depending on what the poster chooses in a select.
And right now I have solved it like this: <img src=''<?php bloginfo('template_url'); ?>/dist/images/<?php echo esc_html($hTeam['value']); ?>-icon.svg'' />
(Nevermind the ‘’ instead of ", the code wouldn’t show otherwise)
It works but not perfect and I would much rather use @asset but I’m not sure how to break out of the asset tag and include the value?
One thing that helped me is that it’s easy to think of directives as functions, but they aren’t really a function in the way you think: They’re instructions for generating PHP.
I think you can also do (not sure if this works in Sage 9): <img src="{{ \Roots\asset('images/vendor-' . $brand['img']) }}" alt="{{ $brand['name'] }} logo">