Skip to content

Commit a682280

Browse files
committed
Tweaking Twig debugging notes
1 parent 533ed24 commit a682280

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

book/templating.rst

+10-7
Original file line numberDiff line numberDiff line change
@@ -1152,9 +1152,13 @@ in a JavaScript string, use the ``js`` context:
11521152
Debugging
11531153
---------
11541154

1155-
When using PHP and the templating engine you can use ``var_dump()`` if you
1156-
need to quickly find the value of a variable passed to the template. The
1157-
same can be achieved when using Twig by using the debug extension. This
1155+
.. versionadded:: 2.0.9
1156+
This feature is available as of Twig ``1.5.x``, which was first shipped
1157+
with Symfony 2.0.9.
1158+
1159+
When using PHP, you can use ``var_dump()`` if you need to quickly find the
1160+
value of a variable passed. This is useful, for example, inside your controller.
1161+
The same can be achieved when using Twig by using the debug extension. This
11581162
needs to be enabled in the config:
11591163

11601164
.. configuration-block::
@@ -1186,7 +1190,6 @@ needs to be enabled in the config:
11861190
$definition->addTag('twig.extension');
11871191
$container->setDefinition('acme_hello.twig.extension.debug', $definition);
11881192
1189-
11901193
Template parameters can then be dumped using the ``dump`` function:
11911194

11921195
.. code-block:: html+jinja
@@ -1202,9 +1205,9 @@ Template parameters can then be dumped using the ``dump`` function:
12021205
{% endfor %}
12031206

12041207

1205-
The variables will only be dumped if Twig's debug setting is set to true.
1206-
By default this means that the variables will be dumped in the ``dev`` environment
1207-
but not the ``prod`` environment.
1208+
The variables will only be dumped if Twig's ``debug`` setting (in ``config.yml``)
1209+
is ``true``. By default this means that the variables will be dumped in the
1210+
``dev`` environment but not the ``prod`` environment.
12081211

12091212
Template Formats
12101213
----------------

0 commit comments

Comments
 (0)