chore: copy ep_products and ep_theme from EP/website@9593cc8
Copied unchanged from public/typo3conf/ext/ of EP/website at 9593cc8631354f8a363d6609de8b7433f669a9a0 (Git-tracked files only). History stays in the old repository. Only composer.json files are added so the extensions install as path packages. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
59afaecea1
commit
a46918de9d
778 files changed
+67000
-2
No files matched your search
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace EP\EpTheme\ViewHelpers\Stimulus;
|
||||
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* This code is adapted from the Symfony WebpackEncoreBundle package.
|
||||
* (c) Fabien Potencier <[email protected]>
|
||||
*/
|
||||
class TargetViewHelper extends AbstractStimulusViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
protected $escapeOutput = false;
|
||||
|
||||
public function initializeArguments()
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
$this->registerArgument('controller', 'mixed', 'Controller name(s)', true);
|
||||
$this->registerArgument('targets', 'string', 'Target names', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @return string
|
||||
*/
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
)
|
||||
{
|
||||
$dataOrControllerName = $arguments['controller'];
|
||||
$targetNames = $arguments['target'];
|
||||
|
||||
if (\is_string($dataOrControllerName)) {
|
||||
$data = [$dataOrControllerName => $targetNames];
|
||||
} else {
|
||||
if ($targetNames) {
|
||||
throw new \InvalidArgumentException('You cannot pass a string to the second argument while passing an array to the first argument of stimulus_target(): check the documentation.');
|
||||
}
|
||||
|
||||
$data = $dataOrControllerName;
|
||||
|
||||
if (!$data) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
$targets = [];
|
||||
|
||||
foreach ($data as $controllerName => $targetNames) {
|
||||
$controllerName = static::normalizeControllerName($controllerName);
|
||||
|
||||
$targets['data-'.$controllerName.'-target'] = htmlspecialchars($targetNames, ENT_QUOTES);
|
||||
}
|
||||
|
||||
return implode(' ', array_map(static function (string $attribute, string $value): string {
|
||||
return $attribute.'="'.$value.'"';
|
||||
}, array_keys($targets), $targets));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user