From a02f175b96ccf29e7c7f27447f3afad76c00f8c3 Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Fri, 8 Dec 2023 11:11:25 +0100 Subject: [PATCH] [Routing] Improving language, shortening twig code Page: https://symfony.com/doc/6.3/routing.html#getting-the-route-name-and-parameters * The first sentence wasn't english. * Defining a Twig variable for this is quite useless nowadays - this looks like a leftover from previous versions where the syntax was lengthy: https://symfony.com/doc/5.4/routing.html#getting-the-route-name-and-parameters --- routing.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/routing.rst b/routing.rst index 701814e0767..66cd714e782 100644 --- a/routing.rst +++ b/routing.rst @@ -1603,15 +1603,14 @@ information in a controller via the ``Request`` object:: } } -You can get this information in services too injecting the ``request_stack`` -service to :doc:`get the Request object in a service `. -In templates, use the :ref:`Twig global app variable ` to get +To get this information in a service, see :doc:`/service_container/request`. +In templates, you can use the :ref:`Twig global app variable ` to get the current route and its attributes: .. code-block:: twig - {% set route_name = app.current_route %} - {% set route_parameters = app.current_route_parameters %} + {% app.current_route %} + {% app.current_route_parameters %} .. versionadded:: 6.2