‪TYPO3CMS  9.5
RemoveUserViewHelper.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
20 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
21 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
22 use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
23 
29 class ‪RemoveUserViewHelper extends AbstractViewHelper
30 {
31  use CompileWithRenderStatic;
32 
36  public function ‪initializeArguments()
37  {
38  $this->registerArgument('backendUser', BackendUser::class, 'Target backendUser to switch active session to', true);
39  }
40 
50  public static function ‪renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
51  {
52  $urlParameters = [
53  'cmd[be_users][' . $arguments['backendUser']->getUid() . '][delete]' => 1,
54  'redirect' => GeneralUtility::getIndpEnv('REQUEST_URI')
55  ];
56  $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
57  return (string)$uriBuilder->buildUriFromRoute('tce_db', $urlParameters);
58  }
59 }
‪TYPO3\CMS\Beuser\ViewHelpers
Definition: ArrayElementViewHelper.php:2
‪TYPO3\CMS\Beuser\ViewHelpers\RemoveUserViewHelper\initializeArguments
‪initializeArguments()
Definition: RemoveUserViewHelper.php:35
‪TYPO3\CMS\Beuser\ViewHelpers\RemoveUserViewHelper\renderStatic
‪static string renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
Definition: RemoveUserViewHelper.php:49
‪TYPO3\CMS\Backend\Routing\UriBuilder
Definition: UriBuilder.php:35
‪TYPO3\CMS\Beuser\ViewHelpers\RemoveUserViewHelper
Definition: RemoveUserViewHelper.php:30
‪TYPO3\CMS\Beuser\Domain\Model\BackendUser
Definition: BackendUser.php:22
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45