It seem I have problem with a twig if statement.
{%if fields | length > 0 || trans_fields | length > 0 -%}
The error is:
Unexpected token "punctuation" of value "|" ("name" expected) in
I can't understand why this doesn't work, it's like if twig was lost with all the pipes.
I've tried this :
{% set count1 = fields | length %}
{% set count2 = trans_fields | length %}
{%if count1 > 0 || count2 > 0 -%}
but the if also fail.
Then tried this:
{% set count1 = fields | length > 0 %}
{% set count2 = trans_fields | length > 0 %}
{%if count1 || count2 -%}
And it still doesn't work, same error every time ...
So... that lead me to a really simple question: does Twig support multiple conditions IF ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…