/** * On the post parse event, add the "layoutName" variable to the variable container so it can be used by the TemplateView. * * @param Tx_Fluid_Core_Parser_SyntaxTree_ViewHelperNode $syntaxTreeNode * @param array $viewHelperArguments * @param Tx_Fluid_Core_ViewHelper_TemplateVariableContainer $variableContainer * @return void * @author Sebastian Kurfürst <*****@*****.**> */ public static function postParseEvent(Tx_Fluid_Core_Parser_SyntaxTree_ViewHelperNode $syntaxTreeNode, array $viewHelperArguments, Tx_Fluid_Core_ViewHelper_TemplateVariableContainer $variableContainer) { if (isset($viewHelperArguments['name'])) { $layoutName = $viewHelperArguments['name']->getText(); } else { $layoutName = 'default'; } $variableContainer->add('layoutName', $layoutName); }
/** * @test * @author Bastian Waidelich <*****@*****.**> */ public function assignMultipleCanOverridePreviouslyAssignedValues() { $this->templateVariableContainer->expects($this->at(0))->method('exists')->with('foo')->will($this->returnValue(FALSE)); $this->templateVariableContainer->expects($this->at(1))->method('add')->with('foo', 'FooValue'); $this->templateVariableContainer->expects($this->at(2))->method('exists')->with('foo')->will($this->returnValue(TRUE)); $this->templateVariableContainer->expects($this->at(3))->method('remove')->with('foo'); $this->templateVariableContainer->expects($this->at(4))->method('add')->with('foo', 'FooValueOverridden'); $this->templateVariableContainer->expects($this->at(5))->method('exists')->with('bar')->will($this->returnValue(FALSE)); $this->templateVariableContainer->expects($this->at(6))->method('add')->with('bar', 'BarValue'); $this->view->assign('foo', 'FooValue'); $this->view->assignMultiple(array('foo' => 'FooValueOverridden', 'bar' => 'BarValue')); }
/** * Save the associated view helper node in a static public class variable. * called directly after the view helper was built. * * @param Tx_Fluid_Core_Parser_SyntaxTree_ViewHelperNode $syntaxTreeNode * @param array $viewHelperArguments * @param Tx_Fluid_Core_ViewHelper_TemplateVariableContainer $variableContainer * @return void * @author Sebastian Kurfürst <*****@*****.**> */ public static function postParseEvent(Tx_Fluid_Core_Parser_SyntaxTree_ViewHelperNode $syntaxTreeNode, array $viewHelperArguments, Tx_Fluid_Core_ViewHelper_TemplateVariableContainer $variableContainer) { $viewHelperArguments['name']->setRenderingContext(new Tx_Fluid_Core_Rendering_RenderingContext()); $sectionName = $viewHelperArguments['name']->evaluate(); if (!$variableContainer->exists('sections')) { $variableContainer->add('sections', array()); } $sections = $variableContainer->get('sections'); $sections[$sectionName] = $syntaxTreeNode; $variableContainer->remove('sections'); $variableContainer->add('sections', $sections); }