TYPO3 CMS  TYPO3_6-2
ParsingState.php
Go to the documentation of this file.
1 <?php
3 
4 /* *
5  * This script is backported from the TYPO3 Flow package "TYPO3.Fluid". *
6  * *
7  * It is free software; you can redistribute it and/or modify it under *
8  * the terms of the GNU Lesser General Public License, either version 3 *
9  * of the License, or (at your option) any later version. *
10  * *
11  * The TYPO3 project - inspiring people to share! *
12  * */
13 
20 
26  protected $rootNode;
27 
33  protected $nodeStack = array();
34 
42  protected $variableContainer;
43 
49  protected $layoutNameNode;
50 
54  protected $compilable = TRUE;
55 
62  public function setRootNode(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $rootNode) {
63  $this->rootNode = $rootNode;
64  }
65 
71  public function getRootNode() {
72  return $this->rootNode;
73  }
74 
81  public function render(\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext) {
82  return $this->rootNode->evaluate($renderingContext);
83  }
84 
92  public function pushNodeToStack(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $node) {
93  array_push($this->nodeStack, $node);
94  }
95 
101  public function getNodeFromStack() {
102  return $this->nodeStack[count($this->nodeStack) - 1];
103  }
104 
110  public function popNodeFromStack() {
111  return array_pop($this->nodeStack);
112  }
113 
119  public function countNodeStack() {
120  return count($this->nodeStack);
121  }
122 
129  public function getVariableContainer() {
131  }
132 
137  public function setLayoutNameNode(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $layoutNameNode) {
138  $this->layoutNameNode = $layoutNameNode;
139  }
140 
144  public function getLayoutNameNode() {
145  return $this->layoutNameNode;
146  }
147 
154  public function hasLayout() {
155  return $this->layoutNameNode !== NULL;
156  }
157 
167  public function getLayoutName(\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext) {
168  if (!$this->hasLayout()) {
169  return NULL;
170  }
171  $layoutName = $this->layoutNameNode->evaluate($renderingContext);
172  if (!empty($layoutName)) {
173  return $layoutName;
174  }
175  throw new \TYPO3\CMS\Fluid\View\Exception('The layoutName could not be evaluated to a string', 1296805368);
176  }
177 
181  public function isCompilable() {
182  return $this->compilable;
183  }
184 
188  public function setCompilable($compilable) {
189  $this->compilable = $compilable;
190  }
191 
195  public function isCompiled() {
196  return FALSE;
197  }
198 }
getLayoutName(\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
pushNodeToStack(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $node)
setRootNode(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $rootNode)
render(\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
setLayoutNameNode(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $layoutNameNode)