‪TYPO3CMS  10.4
ActionMenuViewHelper.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
18 use TYPO3Fluid\Fluid\Core\Compiler\TemplateCompiler;
19 use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\ViewHelperNode;
20 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;
21 
51 class ‪ActionMenuViewHelper extends AbstractTagBasedViewHelper
52 {
56  protected ‪$tagName = 'select';
57 
63  protected ‪$childNodes = [];
64 
70  public function ‪initializeArguments()
71  {
72  parent::initializeArguments();
73  $this->registerArgument('defaultController', 'string', 'The default controller to be used');
74  }
75 
81  public function ‪render()
82  {
83  $this->tag->addAttribute('onchange', 'window.location.href = this.options[this.selectedIndex].value;');
84  $options = '';
85  foreach ($this->childNodes as $childNode) {
86  if ($childNode instanceof ViewHelperNode) {
87  $options .= $childNode->evaluate($this->renderingContext);
88  }
89  }
90  $this->tag->setContent($options);
91  return '<div class="docheader-funcmenu">' . $this->tag->render() . '</div>';
92  }
93 
101  public function ‪compile($argumentsName, $closureName, &$initializationPhpCode, ViewHelperNode $node, TemplateCompiler $compiler)
102  {
103  // @TODO: replace with a true compiling method to make compilable!
104  $compiler->disable();
105  return null;
106  }
107 }
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Menus\ActionMenuViewHelper\compile
‪compile($argumentsName, $closureName, &$initializationPhpCode, ViewHelperNode $node, TemplateCompiler $compiler)
Definition: ActionMenuViewHelper.php:99
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Menus\ActionMenuViewHelper\$tagName
‪string $tagName
Definition: ActionMenuViewHelper.php:55
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Menus\ActionMenuViewHelper\render
‪string render()
Definition: ActionMenuViewHelper.php:79
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Menus\ActionMenuViewHelper\initializeArguments
‪initializeArguments()
Definition: ActionMenuViewHelper.php:68
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Menus\ActionMenuViewHelper
Definition: ActionMenuViewHelper.php:52
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Menus\ActionMenuViewHelper\$childNodes
‪array $childNodes
Definition: ActionMenuViewHelper.php:61
‪TYPO3\CMS\Fluid\ViewHelpers\Be\Menus
Definition: ActionMenuItemGroupViewHelper.php:16