Commit f4fac8d0 authored by Elias Häußler's avatar Elias Häußler Committed by Christian Kuhn
Browse files

[TASK] Streamline generated links to switch Backend user

Both links to switch Backend user (Backend toolbar item
and SwitchUser view helper) are now streamlined.

Resolves: #93228
Releases: master
Change-Id: I5225bff74ebdd8cfcda698d43f4b7823524bf0a9
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/67347

Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 759e8daa
......@@ -15,6 +15,7 @@
namespace TYPO3\CMS\Beuser\ViewHelpers;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Beuser\Domain\Model\BackendUser;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
......@@ -64,9 +65,13 @@ class SwitchUserViewHelper extends AbstractViewHelper
return '<span class="btn btn-default disabled">' . $iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
}
$title = LocalizationUtility::translate('switchBackMode', 'beuser') ?? '';
return '<a class="btn btn-default" href="' .
htmlspecialchars(GeneralUtility::linkThisScript(['SwitchUser' => $backendUser->getUid()])) .
'" target="_top" title="' . htmlspecialchars($title) . '">' .
$uri = GeneralUtility::makeInstance(UriBuilder::class)->buildUriFromRoute(
'system_BeuserTxBeuser',
[
'SwitchUser' => $backendUser->getUid(),
]
);
return '<a class="btn btn-default" href="' . htmlspecialchars((string)$uri) . '" target="_top" title="' . htmlspecialchars($title) . '">' .
$iconFactory->getIcon('actions-system-backend-user-switch', Icon::SIZE_SMALL)->render() . '</a>';
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment