[TASK] Makes sys_note/DeleteLinkViewHelper compilable 75/39375/3
authorJan Helke <typo3@helke.de>
Sat, 9 May 2015 09:09:23 +0000 (11:09 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Sat, 9 May 2015 13:37:28 +0000 (15:37 +0200)
Resolves: #66866
Releases: master
Change-Id: Ib10e6cca908321d81b3a7aa1919cee0e962fc25e
Reviewed-on: http://review.typo3.org/39375
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/DeleteLinkViewHelper.php

index baaa3e1..bd80891 100644 (file)
@@ -16,14 +16,16 @@ namespace TYPO3\CMS\SysNote\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;
 
 /**
  * ViewHelper to create a link to delete a note
  *
  * @internal
  */
-class DeleteLinkViewHelper extends AbstractViewHelper {
+class DeleteLinkViewHelper extends AbstractViewHelper implements CompilableInterface {
 
        /**
         * Create link to delete a note
@@ -32,8 +34,25 @@ class DeleteLinkViewHelper extends AbstractViewHelper {
         * @return string link
         */
        public function render($id) {
+               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) {
                $urlParameters = [
-                       'cmd[sys_note][' . $id . '][delete]' => 1,
+                       'cmd[sys_note][' . $arguments['id'] . '][delete]' => 1,
                        'redirect' => GeneralUtility::getIndpEnv('REQUEST_URI')
                ];
                $url = BackendUtility::getModuleUrl('tce_db', $urlParameters) . BackendUtility::getUrlToken('tceAction');