[TASK] Makes beuser/EditRecordViewHelper compilable 18/39218/2
authorJan Helke <typo3@helke.de>
Sat, 2 May 2015 21:06:44 +0000 (23:06 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sun, 3 May 2015 10:55:56 +0000 (12:55 +0200)
Resolves: #66763
Releases: master
Change-Id: Ie7697c5d9eead20edfeb7c278d97a72f7598e394
Reviewed-on: http://review.typo3.org/39218
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/beuser/Classes/ViewHelpers/EditRecordViewHelper.php

index 94bcaa2..35414e0 100644 (file)
@@ -15,13 +15,17 @@ namespace TYPO3\CMS\Beuser\ViewHelpers;
  */
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+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;
 
 /**
  * Edit Record ViewHelper, see FormEngine logic
  *
  * @internal
  */
-class EditRecordViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
+class EditRecordViewHelper extends AbstractViewHelper implements CompilableInterface {
 
        /**
         * Returns a URL to link to FormEngine
@@ -31,8 +35,24 @@ class EditRecordViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractView
         * @see \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl()
         */
        public function render($parameters) {
-               $parameters = \TYPO3\CMS\Core\Utility\GeneralUtility::explodeUrl2Array($parameters);
-               return BackendUtility::getModuleUrl('record_edit', $parameters);
+               return self::renderStatic(
+                       array(
+                               'parameters' => $parameters
+                       ),
+                       $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) {
+               $parameters = GeneralUtility::explodeUrl2Array($arguments['parameters']);
+               return BackendUtility::getModuleUrl('record_edit', $parameters);
+       }
 }