Determine if entry has a specific category I am using a supertable (or matrix) to create rows.
In each row, I have a Category Field. Multiple categories can be selected for each matrix row.
As I loop over each row, I want to determine if the category field in that row has a specific category selected.
Example:
Matrix Row1:
-&gt; Colour (Category Field):
--&gt; Red, Orange, Blue

Matrix Row2:
-&gt; Colour (Category Field):
--&gt; Red, Blue

In the above example, in Twig, when I render out the row, I want to know if that row should be &quot;Orange&quot; or not, based on whether or not the &quot;Orange&quot; category was selected in the &quot;Colour&quot; field.
I can loop through every selected category in the category field, and plaintext match against it (example below), but I wondered if there is a cleaner/simpler way to do this.
{% set colourFlag = false %}
{% for class in row.rowSettings.rowColour.all() %}
    {% set colourFlag = (class == &quot;orange&quot; ? true) %}
{% endfor %}            
{{ colourFlag == true ? &quot;yes-orange&quot; : &quot;no-orange&quot;}}

Any advice would be grateful.
You could explicitly try to fetch orange and check whether you get a result or not:
{{ row.rowSettings.rowColour.slug('orange').one() ? 'orange is set' : 'orange is not set' }}