2 declare(strict_types = 1);
24 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
25 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
26 use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
27 use TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperVariableContainer;
28 use TYPO3Fluid\Fluid\View\Exception;
32 use CompileWithRenderStatic;
41 $this->registerArgument(
'icon',
'string',
'Icon identifier for the button');
42 $this->registerArgument(
'title',
'string',
'Title of the button');
43 $this->registerArgument(
'disabled',
'bool',
'Whether the button is disabled',
false,
false);
44 $this->registerArgument(
'showLabel',
'bool',
'Defines whether to show the title as a label within the button',
false,
false);
45 $this->registerArgument(
'position',
'string',
'Position of the button (left or right)');
46 $this->registerArgument(
'group',
'integer',
'Button group of the button');
58 \Closure $renderChildrenClosure,
59 RenderingContextInterface $renderingContext
61 $viewHelperVariableContainer = $renderingContext->getViewHelperVariableContainer();
65 $moduleTemplate = $viewHelperVariableContainer->get(ModuleLayoutViewHelper::class, ModuleTemplate::class);
66 $buttonBar = $moduleTemplate->getDocHeaderComponent()->getButtonBar();
69 $group = $arguments[
'group'] ?? 1;
70 $button = static::createButton($buttonBar, $arguments, $renderingContext);
74 $buttonBar->addButton($button, $position, $group);
83 private static function ensureProperNesting(ViewHelperVariableContainer $viewHelperVariableContainer): void
85 if (!$viewHelperVariableContainer->exists(ModuleLayoutViewHelper::class, ModuleTemplate::class)) {
86 throw new Exception(sprintf(
'%s must be nested in <f.be.moduleLayout> ViewHelper', self::class), 1531216505);
93 if (isset($arguments[
'title'])) {
97 $moduleTemplate = $renderingContext->getViewHelperVariableContainer()->get(ModuleLayoutViewHelper::class, ModuleTemplate::class);