Archive for January 2012


Symfony2 – Get action name from twig templates

January 27th, 2012 — 1:49pm

This is the easyest way that I have found to get the action name from a twig template:

 
{{ app.request.attributes.get('_template').get('name') }}

…and the controller object:

 
{{ app.request.attributes.get('_template').get('controller') }}

Comment » | snippet, Symfony2, twig

Back to top