8000 minor #10232 Documenting debug:twig command (yceruto) · symfony/symfony-docs@3800041 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3800041

Browse files
committed
minor #10232 Documenting debug:twig command (yceruto)
This PR was merged into the master branch. Discussion ---------- Documenting debug:twig command See symfony/symfony#27981 Commits ------- 1026020 Documenting debug:twig command
2 parents 9e00412 + 1026020 commit 3800041

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

templating/debug.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,17 @@ By design, the ``dump()`` function is only available in the ``dev`` and ``test``
6767
environments, to avoid leaking sensitive information in production. In fact,
6868
trying to use the ``dump()`` function in the ``prod`` environment will result in
6969
a PHP error.
70+
71+
Execute this command to list all Twig functions, filters, globals, tests and
72+
registered namespaces and their paths:
73+
74+
.. code-block:: terminal
75+
76+
# list general information
77+
$ php bin/console debug:twig
78+
79+
# filter output by any keyword
80+
$ php bin/console debug:twig --filter=date
81+
82+
# pass a template name to show the physical file which will be loaded
83+
$ php bin/console debug:twig @Twig/Exception/error.html.twig

templating/namespaced_paths.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ in the ``vendor/acme/foo-bar/templates/`` directory, you can refer to it as:
7171
7272
{{ include('@foo_bar/sidebar.twig') }}
7373
74+
Execute this command to verify if your template name is correct and know which
75+
template file will be loaded:
76+
77+
.. code-block:: terminal
78+
79+
$ php bin/console debug:twig @foo_bar/sidebar.twig
80+
7481
Multiple Paths per Namespace
7582
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7683

templating/twig_extension.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ Next, register your class as a service and tag it with ``twig.extension``. If yo
7070
using the :ref:`default services.yaml configuration <service-container-services-load-example>`,
7171
you're done! Symfony will automatically know about your new service and add the tag.
7272

73+
Execute this command to verify if your new filter was successfully registered:
74+
75+
.. code-block:: terminal
76+
77+
$ php bin/console debug:twig --filter=price
78+
7379
You can now start using your filter in any Twig template.
7480

7581
Creating Lazy-Loaded Twig Extensions

0 commit comments

Comments
 (0)
0