I have created a checkbox option for a field.
Category
One
Two
Three
Four
This is the code I am using.
{% for key, item in content.field_room_category if key|first != '#' %}
<li>{{ item }}</li>
{% endfor %}
In the <li>
tag, I get all the checked values, but I also need to check which values have been selected.
For this, I tried {{ item.value }}
, {{ item.content }}
, and {{ item['#title'] }}
. None of them worked.
Is there any way to get all the checkbox items with their values?
I want to achieve something similar to the image above. If the item is checked, I show an icon; if the item is unchecked, another icon will be shown.