[SOLVED] How to get route param in Twig Extension


I am trying to create a twig extension for a multilingual application to replace path_for() which forces me to write each time the country id as an argument (I want to make it automatic by getting the first param in the URL)

Nevermind… My issue is that I am trying to get the country id from $request->getAttribute('routeInfo') but it’s empty :frowning:

Any kind of ideas to solve this problem?


Edit: Found the solution !! Just had to add the Twig Extension in a Middleware and call this middleware on the group :slight_smile: