18 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;
63 parent::initializeArguments();
64 $this->registerArgument(
'label',
'string',
'label of the option tag',
true);
65 $this->registerArgument(
'controller',
'string',
'controller to be associated with this ActionMenuItem',
true);
66 $this->registerArgument(
'action',
'string',
'the action to be associated with this ActionMenuItem',
true);
67 $this->registerArgument(
'arguments',
'array',
'additional controller arguments to be passed to the action when this ActionMenuItem is selected',
false, []);
78 $label = $this->arguments[
'label'];
79 $controller = $this->arguments[
'controller'];
80 $action = $this->arguments[
'action'];
81 $arguments = $this->arguments[
'arguments'];
83 $uri = $this->renderingContext->getControllerContext()->getUriBuilder()->reset()->uriFor($action, $arguments, $controller);
84 $this->tag->addAttribute(
'value', $uri);
86 if (!$this->tag->hasAttribute(
'selected')) {
90 $this->tag->setContent(
92 htmlspecialchars($label, ENT_QUOTES,
null,
false)
94 return $this->tag->render();
99 $currentRequest = $this->renderingContext->getControllerContext()->getRequest();
102 'controller' => $currentRequest->getControllerName(),
103 'action' => $currentRequest->getControllerActionName()
104 ], $currentRequest->getArguments())
107 array_merge([
'controller' => $controller,
'action' => $action], $arguments)
110 $this->arguments[
'selected'] ||
111 array_diff($flatRequestArguments, $flatViewHelperArguments) === []
113 $this->tag->addAttribute(
'selected',
'selected');