Is it not possible to define multiple conditions in an if statement?
{% if foo == 'x' || foo == 'y' %}
I tried this and got an error:
Unexpected token "punctuation" of value "|" ("name" expected)
Is it not possible to define multiple conditions in an if statement?
{% if foo == 'x' || foo == 'y' %}
I tried this and got an error:
Unexpected token "punctuation" of value "|" ("name" expected)
Twig doesn't accept || or &&... Try using or and and instead.
{% if foo == 'x' or foo == 'y' %}
Important to note, they must be lowercase.
You may also want to take a look at this question, which shows another way to write a similar condition:
{% if foo in ['x', 'y'] %}