TYPO3 CMS  TYPO3_8-7
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 
19 
49 {
53  protected $tagName = 'select';
54 
60  protected $childNodes = [];
61 
68  public function setChildNodes(array $childNodes)
69  {
70  $this->childNodes = $childNodes;
71  }
72 
79  public function initializeArguments()
80  {
81  parent::initializeArguments();
82  $this->registerArgument('defaultController', 'string', 'defaultController');
83  }
84 
90  public function render()
91  {
92  $this->tag->addAttribute('onchange', 'jumpToUrl(this.options[this.selectedIndex].value, this);');
93  $options = '';
94  foreach ($this->childNodes as $childNode) {
95  if ($childNode instanceof \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode) {
96  $options .= $childNode->evaluate($this->renderingContext);
97  }
98  }
99  $this->tag->setContent($options);
100  return '<div class="docheader-funcmenu">' . $this->tag->render() . '</div>';
101  }
102 
110  public function compile($argumentsName, $closureName, &$initializationPhpCode, ViewHelperNode $node, TemplateCompiler $compiler)
111  {
112  // @TODO: replace with a true compiling method to make compilable!
113  $compiler->disable();
114  return null;
115  }
116 }
compile($argumentsName, $closureName, &$initializationPhpCode, ViewHelperNode $node, TemplateCompiler $compiler)