Skip to content

Commit fd2958d

Browse files
committed
Tweaks
1 parent 5137e22 commit fd2958d

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

security/login_link.rst

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -740,17 +740,16 @@ Then, configure this service ID as the ``success_handler``:
740740
],
741741
]);
742742
743-
Customize generated Login Link
744-
------------------------------
743+
Customizing the Login Link
744+
--------------------------
745745

746746
.. versionadded:: 5.3
747747

748748
The possibility to customize the login link was introduced in Symfony 5.3.
749749

750-
In some use cases it may be useful to customize the Login Link. In addition
751-
to the ``UserInterface``, it is therefore possible to pass a ``Request`` to the ``createLoginLink``
752-
method. In this example, our route is localized with the user locale which may
753-
be different from the current locale::
750+
The ``createLoginLink()`` method accepts a second optional argument to pass the
751+
``Request`` object used when generating the login link. This allows to customize
752+
features such as the locale used to generate the link::
754753

755754
// src/Controller/SecurityController.php
756755
namespace App\Controller;
@@ -774,8 +773,7 @@ be different from the current locale::
774773
$userRequest = clone $request;
775774
$userRequest->setLocale($user->getLocale() ?? $request->getDefaultLocale());
776775

777-
// create a login link for $user this returns an instance
778-
// of LoginLinkDetails
776+
// create a login link for $user (this returns an instance of LoginLinkDetails)
779777
$loginLinkDetails = $loginLinkHandler->createLoginLink($user, $userRequest);
780778
$loginLink = $loginLinkDetails->getUrl();
781779

0 commit comments

Comments
 (0)