[TASK] Makes belog/IsExtensionLoadedViewHelper compilable 93/39193/2
authorJan Helke <typo3@helke.de>
Sat, 2 May 2015 12:54:57 +0000 (14:54 +0200)
committerFrank Nägler <typo3@naegler.net>
Sat, 2 May 2015 13:29:49 +0000 (15:29 +0200)
Resolves: #66739
Releases: master
Change-Id: I7e97d848710e33f63350e158877083a0b87b9669
Reviewed-on: http://review.typo3.org/39193
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Frank Nägler <typo3@naegler.net>
Tested-by: Frank Nägler <typo3@naegler.net>
typo3/sysext/belog/Classes/ViewHelpers/IsExtensionLoadedViewHelper.php

index beaca5c..070facb 100644 (file)
@@ -13,6 +13,9 @@ namespace TYPO3\CMS\Belog\ViewHelpers;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
+use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface;
+use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
 
 /**
  * Returns true, if a specific extension is loaded
@@ -20,7 +23,7 @@ namespace TYPO3\CMS\Belog\ViewHelpers;
  * @author Christian Kuhn <lolli@schwarzbu.ch>
  * @internal
  */
-class IsExtensionLoadedViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
+class IsExtensionLoadedViewHelper extends AbstractViewHelper {
 
        /**
         * Checks whether an extension is loaded.
@@ -29,7 +32,23 @@ class IsExtensionLoadedViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abstr
         * @return bool TRUE if extension is loaded, FALSE otherwise
         */
        public function render($extensionKey) {
-               return \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extensionKey);
+               return self::renderStatic(
+                       array(
+                               'extensionKey' => $extensionKey
+                       ),
+                       $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 ExtensionManagementUtility::isLoaded($arguments['extensionKey']);
+       }
 }