[TASK] Makes beuser/RemoveUserViewHelper compilable 29/39229/3
authorJan Helke <typo3@helke.de>
Sun, 3 May 2015 09:00:24 +0000 (11:00 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Sun, 3 May 2015 10:26:55 +0000 (12:26 +0200)
Resolves: #66769
Releases: master
Change-Id: I4b1f9f5d4727ce7a4dcbd557f1fd15c078933bdc
Reviewed-on: http://review.typo3.org/39229
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/beuser/Classes/ViewHelpers/RemoveUserViewHelper.php

index 614bab8..6a36ba2 100644 (file)
@@ -20,14 +20,16 @@ use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface;
 use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
+use TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface;
 
 /**
  * Displays 'Delete user' link with sprite icon to remove user
  *
  * @internal
  */
-class RemoveUserViewHelper extends AbstractViewHelper {
+class RemoveUserViewHelper extends AbstractViewHelper implements CompilableInterface {
 
        /**
         * Render link with sprite icon to remove user
@@ -36,6 +38,25 @@ class RemoveUserViewHelper extends AbstractViewHelper {
         * @return string
         */
        public function render(BackendUser $backendUser) {
+               return self::renderStatic(
+                       array(
+                               'backendUser' => $backendUser
+                       ),
+                       $this->buildRenderChildrenClosure(),
+                       $this->renderingContext
+               );
+       }
+
+       /**
+        * @param array $arguments
+        * @param callable $renderChildrenClosure
+        * @param RenderingContextInterface $renderingContext
+        *
+        * @return string
+        */
+       static public function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) {
+               /** @var \TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser */
+               $backendUser = $arguments['backendUser'];
                /** @var BackendUserAuthentication $beUser */
                $beUser = $GLOBALS['BE_USER'];
                if ($backendUser->getUid() === (int)$beUser->user['uid']) {