Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb7bd572

Browse files
author
Damien Fayet
committed
Leave impersonation functions
1 parent070450b commitb7bd572

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

‎reference/twig_reference.rst‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,33 @@ expression
267267
Creates an:class:`Symfony\\Component\\ExpressionLanguage\\Expression` related
268268
to the:doc:`ExpressionLanguage component</components/expression_language>`.
269269

270+
impersonation_exit_path
271+
~~~~~~~~~~~~~~~~~~~~~~~
272+
273+
..code-block::twig
274+
275+
{{ impersonation_exit_path(exitTo = null) }}
276+
277+
``exitTo`` *(optional)*
278+
**type**: ``string``
279+
280+
Generates a relative URL to exit impersonation. If `exitTo` is specified it will use its value to build the URl,
281+
elsewhere it will use the current URI.
282+
If we are not impersonating a user, it will return an empty string.
283+
284+
impersonation_exit_url
285+
~~~~~~~~~~~~~~~~~~~~~~
286+
287+
..code-block::twig
288+
289+
{{ impersonation_exit_url(exitTo = null) }}
290+
291+
``exitTo`` *(optional)*
292+
**type**: ``string``
293+
294+
Equal to the `impersonation_exit_path`_ function, but it'll generate an absolute URL
295+
instead of a relative one.
296+
270297
Form Related Functions
271298
~~~~~~~~~~~~~~~~~~~~~~
272299

‎security/impersonating_user.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ instance, to show a link to exit impersonation in a template:
9494
..code-block::html+twig
9595

9696
{% if is_granted('IS_IMPERSONATOR') %}
97-
<a href="{{ path('homepage', {'_switch_user': '_exit'}) }}">Exit impersonation</a>
97+
<a href="{{impersonation_exit_path(path('homepage')) }}">Exit impersonation</a>
9898
{% endif %}
9999

100100
..versionadded::5.1

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp