Last updated February 19, 2013. Created by Cottser on February 3, 2013.
Log in to edit this page.
Twig provides a dump function for debugging variables in templates.
The dump function outputs information about a template variable. The dump function will not display anything unless twig_debug is enabled. Currently the value of twig_debug is hardcoded pending resolution of #1843034: Make Twig settings configurable.
If your template has a title variable available, the following will dump its contents to your template:{{ dump(title) }}
To dump all available variables in a template, add the following to your template:{{ dump() }}
There are additional global variables available in all Twig templates:
_selfreferences the current template and contains advanced information about a template, i.e. the compiled template class name and information about the Twig environment._contextreferences the current context and contains all variables passed to the template such as variables sent from theme(), prepared by preprocess, or set in the template. Adding{{ dump() }}without specifying a variable is equivalent to{{ dump(_context) }}._charsetreferences the current charset.
See Twig's dump function documentation to learn more about the dump function.