{% if 'some field value' in entity.field_name[0] %} //Output the result that we need
{% else %}
//Output the result if the validation of the value is not successful
{% endif %}
Where:
- entity - entity type
- field_name - machine name of the field we need
Example:
{% if 'In stock' in product.field_stock[0] %}
{{ product.field_stock }}
{% else %} { product.field_stock }}
{% endif %}
- 132 views