/**
  * Save the associated view helper node in a static public class variable.
  * called directly after the view helper was built.
  *
  * @param \TYPO3\Fluid\Core\Parser\SyntaxTree\ViewHelperNode $syntaxTreeNode
  * @param array $viewHelperArguments
  * @param \TYPO3\Fluid\Core\ViewHelper\TemplateVariableContainer $variableContainer
  * @return void
  */
 public static function postParseEvent(\TYPO3\Fluid\Core\Parser\SyntaxTree\ViewHelperNode $syntaxTreeNode, array $viewHelperArguments, \TYPO3\Fluid\Core\ViewHelper\TemplateVariableContainer $variableContainer)
 {
     $sectionName = $viewHelperArguments['name']->getText();
     if (!$variableContainer->exists('sections')) {
         $variableContainer->add('sections', array());
     }
     $sections = $variableContainer->get('sections');
     $sections[$sectionName] = $syntaxTreeNode;
     $variableContainer->remove('sections');
     $variableContainer->add('sections', $sections);
 }
Esempio n. 2
0
 /**
  * On the post parse event, add the "layoutName" variable to the variable container so it can be used by the TemplateView.
  *
  * @param \TYPO3\Fluid\Core\Parser\SyntaxTree\ViewHelperNode $syntaxTreeNode
  * @param array $viewHelperArguments
  * @param \TYPO3\Fluid\Core\ViewHelper\TemplateVariableContainer $variableContainer
  * @return void
  */
 public static function postParseEvent(\TYPO3\Fluid\Core\Parser\SyntaxTree\ViewHelperNode $syntaxTreeNode, array $viewHelperArguments, \TYPO3\Fluid\Core\ViewHelper\TemplateVariableContainer $variableContainer)
 {
     if (isset($viewHelperArguments['name'])) {
         $layoutNameNode = $viewHelperArguments['name'];
     } else {
         $layoutNameNode = new \TYPO3\Fluid\Core\Parser\SyntaxTree\TextNode('Default');
     }
     $variableContainer->add('layoutName', $layoutNameNode);
 }
 /**
  * @test
  * @param string $identifier
  * @dataProvider reservedVariableNameDataProvider
  * @expectedException \TYPO3\Fluid\Core\ViewHelper\Exception\InvalidVariableException
  */
 public function attemptToSetReservedVariableInUncoveredLetterCaseThrowsException($identifier)
 {
     $this->variableContainer->add(strtoupper($identifier), 'foo');
 }
 /**
  * Save the associated ViewHelper node in a static public class variable.
  * called directly after the ViewHelper was built.
  *
  * @param ViewHelperNode $syntaxTreeNode
  * @param array $viewHelperArguments<TextNode>
  * @param TemplateVariableContainer $variableContainer
  * @return void
  */
 public static function postParseEvent(ViewHelperNode $syntaxTreeNode, array $viewHelperArguments, TemplateVariableContainer $variableContainer)
 {
     /** @var $nameArgument TextNode */
     $nameArgument = $viewHelperArguments['name'];
     $sectionName = $nameArgument->getText();
     if (!$variableContainer->exists('sections')) {
         $variableContainer->add('sections', array());
     }
     $sections = $variableContainer->get('sections');
     $sections[$sectionName] = $syntaxTreeNode;
     $variableContainer->remove('sections');
     $variableContainer->add('sections', $sections);
 }