‪TYPO3CMS  ‪main
InstallationStateCssClassViewHelper.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
21 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
22 use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
23 
29 final class ‪InstallationStateCssClassViewHelper extends AbstractViewHelper
30 {
31  use CompileWithRenderStatic;
32 
33  public function ‪initializeArguments(): void
34  {
35  $this->registerArgument('needle', 'string', '', true);
36  $this->registerArgument('haystack', 'array', '', true);
37  }
38 
45  public static function ‪renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext): string
46  {
47  $needle = $arguments['needle'];
48  $haystack = $arguments['haystack'];
49  if (array_key_exists($needle, $haystack)) {
50  if (isset($haystack[$needle]['installed']) && $haystack[$needle]['installed'] === true) {
51  return 'installed';
52  }
53  return 'available';
54  }
55  return '';
56  }
57 }
‪TYPO3\CMS\Extensionmanager\ViewHelpers
‪TYPO3\CMS\Extensionmanager\ViewHelpers\InstallationStateCssClassViewHelper\initializeArguments
‪initializeArguments()
Definition: InstallationStateCssClassViewHelper.php:32
‪TYPO3\CMS\Extensionmanager\ViewHelpers\InstallationStateCssClassViewHelper
Definition: InstallationStateCssClassViewHelper.php:30
‪TYPO3\CMS\Extensionmanager\ViewHelpers\InstallationStateCssClassViewHelper\renderStatic
‪static renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
Definition: InstallationStateCssClassViewHelper.php:44