Is it possible to use the path function dynamically? With variables as parameters?
{{ path(nav.url, { nav.param_name : nav.param_value }) }}
Because if I try to use that code I am getting:
A hash key must be followed by a colon (:).
Unexpected token "punctuation" of value "."
("punctuation" expected with value ":")
I know by passing ‘hardcoded’ the param_name will work… like this:
{{ path('nav.url', { 'id' : nav.param_value }) }}
However I need to pass the 3 value dynamically
The Twig book says you have to enclose expressions in parentheses to use them as keys, so maybe this will work:
http://twig.sensiolabs.org/doc/templates.html#literals