[TASK] Makes beuser/IssueCommandViewHelper compilable 20/39220/2
authorJan Helke <typo3@helke.de>
Sat, 2 May 2015 21:20:08 +0000 (23:20 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Sun, 3 May 2015 10:23:29 +0000 (12:23 +0200)
Resolves: #66764
Releases: master
Change-Id: I404c60a1a4a19f84abe3a85b3c42e9d34be77317
Reviewed-on: http://review.typo3.org/39220
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/beuser/Classes/ViewHelpers/IssueCommandViewHelper.php

index 414037f..6bd56c3 100644 (file)
@@ -17,7 +17,9 @@ namespace TYPO3\CMS\Beuser\ViewHelpers;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface;
 use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
+use TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface;
 
 /**
  * Issue command ViewHelper, see TYPO3 Core Engine method issueCommand
@@ -25,7 +27,7 @@ use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
  * @author Felix Kopp <felix-source@phorax.com>
  * @internal
  */
-class IssueCommandViewHelper extends AbstractViewHelper {
+class IssueCommandViewHelper extends AbstractViewHelper implements CompilableInterface{
 
        /**
         * Returns a URL with a command to TYPO3 Core Engine (tce_db.php)
@@ -38,15 +40,32 @@ class IssueCommandViewHelper extends AbstractViewHelper {
         * @see \TYPO3\CMS\Backend\Template\DocumentTemplate::issueCommand()
         */
        public function render($parameters, $redirectUrl = '') {
+               return self::renderStatic(
+                       array(
+                               'parameters' => $parameters,
+                               'redirectUrl' => $redirectUrl
+                       ),
+                       $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 BackendUserAuthentication $beUser */
                $beUser = $GLOBALS['BE_USER'];
                $urlParameters = [
                        'vC' => $beUser->veriCode(),
                        'prErr' => 1,
                        'uPT' => 1,
-                       'redirect' => $redirectUrl ?: GeneralUtility::getIndpEnv('REQUEST_URI')
+                       'redirect' => $arguments['redirectUrl'] ?: GeneralUtility::getIndpEnv('REQUEST_URI')
                ];
-               return htmlspecialchars(BackendUtility::getModuleUrl('tce_db', $urlParameters) . $parameters . BackendUtility::getUrlToken('tceAction'));
+               return htmlspecialchars(BackendUtility::getModuleUrl('tce_db', $urlParameters) . $arguments['parameters'] . BackendUtility::getUrlToken('tceAction'));
        }
-
 }