Skip to content

Commit cd01a9f

Browse files
committed
[TwigBridge] Document the new methods of AppVariable
1 parent 2375fdf commit cd01a9f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

templates.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,17 @@ gives you access to these variables:
377377
``app.token``
378378
A :class:`Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface`
379379
object representing the security token.
380+
``app.current_route_name``
381+
The name of the route associated to the current request or ``null`` if no
382+
request is available (equivalent to ``app.request.attributes.get('_route')``)
383+
``app.current_route_parameters``
384+
An array with the parameters passed to the route of the current request or an
385+
empty array if no request is available (equivalent to ``app.request.attributes.get('_route_params')``)
386+
387+
.. versionadded:: 6.2
388+
389+
The ``app.current_route_name`` and ``app.current_route_parameters`` variables
390+
were introduced in Symfony 6.2.
380391

381392
In addition to the global ``app`` variable injected by Symfony, you can also
382393
:doc:`inject variables automatically to all Twig templates </templating/global_variables>`.

0 commit comments

Comments
 (0)