[TASK] Makes DebugViewHelper compilable 72/39172/4
authorJan Helke <typo3@helke.de>
Fri, 1 May 2015 19:08:35 +0000 (21:08 +0200)
committerFrank Nägler <typo3@naegler.net>
Sat, 2 May 2015 19:21:42 +0000 (21:21 +0200)
Resolves: #66721
Releases: master
Change-Id: Ieae0a99500ef19bf428819906d05e9ed1643b6c0
Reviewed-on: http://review.typo3.org/39172
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Frank Nägler <typo3@naegler.net>
Tested-by: Frank Nägler <typo3@naegler.net>
typo3/sysext/fluid/Classes/ViewHelpers/DebugViewHelper.php

index 2a5a867..2380e8e 100644 (file)
@@ -13,6 +13,11 @@ namespace TYPO3\CMS\Fluid\ViewHelpers;
  * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General      *
  * Public License for more details.                                       *
  *                                                                        */
+use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
+use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface;
+use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
+use TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface;
+
 /**
  * This ViewHelper generates a HTML dump of the tagged variable.
  *
@@ -32,7 +37,7 @@ namespace TYPO3\CMS\Fluid\ViewHelpers;
  * [A HTML view of the var_dump]
  * </output>
  */
-class DebugViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
+class DebugViewHelper extends AbstractViewHelper implements CompilableInterface {
 
        /**
         * A wrapper for \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump().
@@ -47,7 +52,29 @@ class DebugViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelpe
         * @return string
         */
        public function render($title = NULL, $maxDepth = 8, $plainText = FALSE, $ansiColors = FALSE, $inline = FALSE, $blacklistedClassNames = NULL, $blacklistedPropertyNames = NULL) {
-               return \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($this->renderChildren(), $title, $maxDepth, (bool)$plainText, (bool)$ansiColors, (bool)$inline, $blacklistedClassNames, $blacklistedPropertyNames);
+               return self::renderStatic(
+                       array(
+                               'title' => $title,
+                               'maxDepth' => $maxDepth,
+                               'plainText' => $plainText,
+                               'ansiColors' => $ansiColors,
+                               'inline' => $inline,
+                               'blacklistedClassNames' => $blacklistedClassNames,
+                               'blacklistedPropertyNames' => $blacklistedPropertyNames
+                       ),
+                       $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 DebuggerUtility::var_dump($renderChildrenClosure(), $arguments['title'], $arguments['maxDepth'], (bool)$arguments['plainText'], (bool)$arguments['ansiColors'], (bool)$arguments['inline'], $arguments['blacklistedClassNames'], $arguments['blacklistedPropertyNames']);
+       }
 }