Reputation: 5597
I know I can do this:
app.request.get('name')
...but how do I do this?
app.request.get(twig_var_name)
I've tried every obvious solution {{}} () etc.
Is it possible?
Upvotes: 37
Views: 75207
Reputation: 2617
This isn't a problem nowadays (Symfony 4.4 and 5 at least).
I've tried getting a request parameter using this:
{% set getParamName = 'sort' %}
<input type="hidden" name="sort" value="{{ app.request.get(getParamName) }}" />
And there were no issues at all. It works perfectly fine.
Upvotes: 0