Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug Twig?

Tags:

twig

symfony

How can I do serious debugging in Twig? I know how to dump single variables. But what if you have no clue which template is rendering the part of the page you are looking at? Or you want to know which templates are used to render a page?

In Drupal 6/7 I can enable the theme developer module. This allows me to point and click on any part of the page and I get a list of all used templates (and much more information). Maybe I’m asking for too much or doing it the wrong way.

How can I find the template in charge of a particular part of the page? If this is too much, how can I see what templates are called by the Twig engine? Getting a trace would also be helpful.

like image 436
BetaRide Avatar asked Nov 25 '22 04:11

BetaRide


1 Answers

The Developers toolbar (app_dev.php) should list all templates used to render your page.

like image 121
weyandch Avatar answered Dec 06 '22 01:12

weyandch