I've got a node with a field collection, which contains a taxonomy field. I'd like to get the raw value or ID of this taxonomy field, to use in a conditional statement and provide different markup for different values.
e.g.:
{% set imageType = item.content.field_image_type|raw %}
{% if imageType == 'web-desktop' %}
// markup A
{% else %}
// markup B
{% endif %}
The variable works correctly, in that I am getting the expected output when rendering it, however the test always returns false.
What am I doing wrong?
Thanks!
Thanks to @DarkBee for the tip, I dumped the variable and used
['#plain_text']
from the output; the test now works as expected. For reference, here's the code: