[TASK] Make ViewHelpers compilable in ext:extensionmanager
[Packages/TYPO3.CMS.git] / typo3 / sysext / extensionmanager / Classes / ViewHelpers / InstallationStateCssClassViewHelper.php
index 5eb0c39..1c9a21b 100644 (file)
@@ -14,6 +14,10 @@ namespace TYPO3\CMS\Extensionmanager\ViewHelpers;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
+use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface;
+use TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface;
+
 /**
  * Returns a string meant to be used as css class stating whether an extension is
  * available or installed
@@ -21,7 +25,7 @@ namespace TYPO3\CMS\Extensionmanager\ViewHelpers;
  * @author Susanne Moog <susanne.moog@typo3.org>
  * @internal
  */
-class InstallationStateCssClassViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
+class InstallationStateCssClassViewHelper extends AbstractViewHelper implements CompilableInterface {
 
        /**
         * Returns string meant to be used as css class
@@ -34,6 +38,26 @@ class InstallationStateCssClassViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelp
         * @return string the rendered a tag
         */
        public function render($needle, array $haystack) {
+               return self::renderStatic(
+                       array(
+                               'needle' => $needle,
+                               'haystack' => $haystack,
+                       ),
+                       $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) {
+               $needle = $arguments['needle'];
+               $haystack = $arguments['haystack'];
                if (array_key_exists($needle, $haystack)) {
                        if (isset($haystack[$needle]['installed']) && $haystack[$needle]['installed'] === TRUE) {
                                return 'installed';