/** * On the post parse event, add the "layoutName" variable to the variable container so it can be used by the TemplateView. * * @param \F3\Fluid\Core\Parser\SyntaxTree\ViewHelperNode $syntaxTreeNode * @param array $viewHelperArguments * @param \F3\Fluid\Core\ViewHelper\TemplateVariableContainer $variableContainer * @return void * @author Sebastian Kurfürst <*****@*****.**> */ public static function postParseEvent(\F3\Fluid\Core\Parser\SyntaxTree\ViewHelperNode $syntaxTreeNode, array $viewHelperArguments, \F3\Fluid\Core\ViewHelper\TemplateVariableContainer $variableContainer) { if (isset($viewHelperArguments['name'])) { $viewHelperArguments['name']->setRenderingContext(new \F3\Fluid\Core\Rendering\RenderingContext()); $layoutName = $viewHelperArguments['name']->evaluate(); } else { $layoutName = 'default'; } $variableContainer->add('layoutName', $layoutName); }
/** * Save the associated view helper node in a static public class variable. * called directly after the view helper was built. * * @param \F3\Fluid\Core\Parser\SyntaxTree\ViewHelperNode $syntaxTreeNode * @param array $viewHelperArguments * @param \F3\Fluid\Core\ViewHelper\TemplateVariableContainer $variableContainer * @return void * @author Sebastian Kurfürst <*****@*****.**> */ public static function postParseEvent(\F3\Fluid\Core\Parser\SyntaxTree\ViewHelperNode $syntaxTreeNode, array $viewHelperArguments, \F3\Fluid\Core\ViewHelper\TemplateVariableContainer $variableContainer) { $viewHelperArguments['name']->setRenderingContext(new \F3\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); }