The GPL headers named dreipunktnull and an old address and no longer match the license of the code. Co-Authored-By: Claude Opus 5.5 <[email protected]>
33 lines
914 B
PHP
33 lines
914 B
PHP
<?php
|
|
|
|
namespace EP\EpTheme\ViewHelpers;
|
|
|
|
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
|
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
|
|
|
class ThemeClassesViewHelper extends AbstractViewHelper
|
|
{
|
|
public function initializeArguments()
|
|
{
|
|
parent::initializeArguments();
|
|
|
|
$this->registerArgument('key', 'string', 'The theme key', false, 'ep');
|
|
$this->registerArgument('classes', 'array', 'The classes to apply per theme key', true);
|
|
}
|
|
|
|
/**
|
|
* @param array $arguments
|
|
* @param \Closure $renderChildrenClosure
|
|
* @param RenderingContextInterface $renderingContext
|
|
* @return mixed
|
|
*/
|
|
public function render()
|
|
{
|
|
$themeKey = $this->arguments['key'];
|
|
if (!array_key_exists($themeKey, $this->arguments['classes'])) {
|
|
return '';
|
|
}
|
|
return $this->arguments['classes'][$themeKey];
|
|
}
|
|
}
|