[TASK] Makes sys_note/EditLinkViewHelper compilable 76/39376/3
authorJan Helke <typo3@helke.de>
Sat, 9 May 2015 09:24:38 +0000 (11:24 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Sat, 9 May 2015 13:39:35 +0000 (15:39 +0200)
Resolves: #66867
Releases: master
Change-Id: I30ef465f92589d2fcbf379a32700959735b9a41a
Reviewed-on: http://review.typo3.org/39376
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/sys_note/Classes/ViewHelpers/EditLinkViewHelper.php

index a79aa29..8a2deef 100644 (file)
@@ -14,26 +14,50 @@ namespace TYPO3\CMS\SysNote\ViewHelpers;
  * The TYPO3 project - inspiring people to share!
  */
 
+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;
+
 /**
  * ViewHelper to create a link to edit a note
  *
  * @author Georg Ringer <typo3@ringerge.org>
  * @internal
  */
-class EditLinkViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
+class EditLinkViewHelper extends AbstractViewHelper implements CompilableInterface {
 
        /**
         * @param int $id
         * @return string
         */
        public function render($id) {
-               return \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl(
+               return self::renderStatic(
+                       array(
+                               'id' => $id
+                       ),
+                       $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) {
+               return BackendUtility::getModuleUrl(
                        'record_edit',
                        array(
-                               'edit[sys_note][' . $id . ']' => 'edit',
-                               'returnUrl' => \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI')
+                               'edit[sys_note][' . $arguments['id'] . ']' => 'edit',
+                               'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
                        )
                );
+
        }
 
 }