* * * * * ... * * * ``` * * **Note:** This ViewHelper is experimental and tailored to be used only in extbase context. * * @see https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-be-menus-actionmenu */ final class ActionMenuViewHelper extends AbstractTagBasedViewHelper { /** * @var string */ protected $tagName = 'select'; public function __construct( private readonly PageRenderer $pageRenderer ) { parent::__construct(); } public function initializeArguments(): void { parent::initializeArguments(); $this->registerArgument('defaultController', 'string', 'The default controller to be used'); } public function render(): string { $options = ''; foreach ($this->viewHelperNode->getChildNodes() as $childNode) { if ($childNode instanceof ViewHelperNode) { $options .= $childNode->evaluate($this->renderingContext); } } $this->tag->addAttributes([ 'data-global-event' => 'change', 'data-action-navigate' => '$value', ]); $this->tag->setContent($options); $this->pageRenderer->loadJavaScriptModule('@typo3/backend/global-event-handler.js'); return '
' . $this->tag->render() . '
'; } /** * @param string $argumentsName * @param string $closureName * @param string $initializationPhpCode */ public function compile($argumentsName, $closureName, &$initializationPhpCode, ViewHelperNode $node, TemplateCompiler $compiler): string { // @todo: replace with a true compiling method to make compilable! $compiler->disable(); return ''; } }