Reputation: 508
I am a newbie in using twig. How to check if value "filter" exists or not from twig ?
ParameterBag {#10 ▼
#parameters: array:1 [▼
"filter" => "news"
]
}
This is what I got from calling {{ dump(app.request.query) }}
Upvotes: 0
Views: 325
Reputation: 446
Try
{% if foo %}
...
{% endif %}
Or if it's an array and you want to know if it's not empty, try
{% if foo is not empty %}
...
{% endif %}
Upvotes: 3
Reputation: 508
I have found an answer to this question while browsing through the net.
{% if foo is empty %}
...
{% endif %}
This is my answer.
Upvotes: 0