Пример #1
0
 /**
  * On the post parse event, add the "layoutName" variable to the variable container so it can be used by the TemplateView.
  *
  * @param ViewHelperNode $node
  * @param array $arguments
  * @param VariableProviderInterface $variableContainer
  * @return void
  */
 public static function postParseEvent(ViewHelperNode $node, array $arguments, VariableProviderInterface $variableContainer)
 {
     if (isset($arguments['name'])) {
         $layoutNameNode = $arguments['name'];
     } else {
         $layoutNameNode = 'Default';
     }
     $variableContainer->add('layoutName', $layoutNameNode);
 }
Пример #2
0
 /**
  * Returns the name of the layout that is defined within the current template via <f:layout name="..." />
  * If no layout is defined, this returns NULL
  * This requires the current rendering context in order to be able to evaluate the layout name
  *
  * @param RenderingContextInterface $renderingContext
  * @return string
  * @throws View\Exception
  */
 public function getLayoutName(RenderingContextInterface $renderingContext)
 {
     $layoutName = $this->variableContainer->get('layoutName');
     return $layoutName instanceof RootNode ? $layoutName->evaluate($renderingContext) : $layoutName;
 }
Пример #3
0
 /**
  * Returns TRUE if the current template has a template defined via <f:layout name="..." />
  *
  * @return boolean
  */
 public function hasLayout()
 {
     return $this->variableContainer->exists('layoutName');
 }
Пример #4
0
 /**
  * Returns the name of the layout that is defined within the current template via <f:layout name="..." />
  * If no layout is defined, this returns NULL
  * This requires the current rendering context in order to be able to evaluate the layout name
  *
  * @param RenderingContextInterface $renderingContext
  * @return string
  * @throws View\Exception
  */
 public function getLayoutName(RenderingContextInterface $renderingContext)
 {
     return $this->variableContainer->get('layoutName');
 }