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