I have a question, it's possible to make a in_array in twig template? For example I have an array call aColors with colors of one product :
Array[
0 => "1"
1 => "2"
]
And I have a class in Libraries folder :
class Colors{
public static $aColors = array(
'1' => 'White',
'2' => 'Black',
'3' => 'Yellow',
'4' => 'Red',
'5' => 'Green',
'6' => 'Blue',
);
}
Now I want to verify if the values of array with colors of product = with keys of general array with colors, And I tried in .twig :
{% for key,val in aColors %}
{% if val in Colors::aColors %}
{% endfor %}
But not work. Exist a solution? Please help me. Can anyone help me? Thx in advance!!!