‪TYPO3CMS  ‪main
FrontendTypoScript.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
22 
30 {
32  private ?‪RootNode ‪$setupTree = null;
33  private ?array ‪$setupArray = null;
34  private ?‪RootNode ‪$configTree = null;
35  private ?array ‪$configArray = null;
36  private ?‪RootNode ‪$pageTree = null;
37  private ?array ‪$pageArray = null;
38 
39  public function ‪__construct(
40  private readonly ‪RootNode $settingsTree,
41  private readonly array $settingsConditionList,
42  private readonly array $flatSettings,
43  private readonly array $setupConditionList,
44  ) {}
45 
51  public function ‪getSettingsTree(): ‪RootNode
52  {
53  return $this->settingsTree;
54  }
55 
62  public function ‪getSettingsConditionList(): array
63  {
64  return $this->settingsConditionList;
65  }
66 
88  public function ‪getFlatSettings(): array
89  {
90  return $this->flatSettings;
91  }
92 
99  public function ‪getSetupConditionList(): array
100  {
101  return $this->setupConditionList;
102  }
103 
108  {
109  $this->setupIncludeTree = ‪$setupIncludeTree;
110  }
111 
120  {
122  }
123 
128  {
129  $this->setupTree = ‪$setupTree;
130  }
131 
144  public function ‪hasSetup(): bool
145  {
146  return $this->setupTree !== null;
147  }
148 
152  public function ‪getSetupTree(): ‪RootNode
153  {
154  if ($this->setupTree === null) {
155  throw new \RuntimeException(
156  'Setup tree has not been initialized. This happens in cached Frontend scope where full TypoScript' .
157  ' is not needed by the system.',
158  1666513644
159  );
160  }
161  return ‪$this->setupTree;
162  }
163 
167  public function ‪setSetupArray(array ‪$setupArray): void
168  {
169  $this->setupArray = ‪$setupArray;
170  }
171 
179  public function ‪getSetupArray(): array
180  {
181  if ($this->setupArray === null) {
182  throw new \RuntimeException(
183  'Setup array has not been initialized. This happens in cached Frontend scope where full TypoScript' .
184  ' is not needed by the system.',
185  1666513645
186  );
187  }
188  return ‪$this->setupArray;
189  }
190 
194  public function ‪setConfigTree(‪RootNode $setupConfig): void
195  {
196  $this->configTree = $setupConfig;
197  }
198 
212  public function ‪getConfigTree(): ‪RootNode
213  {
214  if ($this->configTree === null) {
215  throw new \RuntimeException(
216  'Setup "config." not initialized. FrontendTypoScriptFactory->createSetupConfigOrFullSetup() not called?',
217  1710666154
218  );
219  }
220  return ‪$this->configTree;
221  }
222 
226  public function ‪setConfigArray(array ‪$configArray): void
227  {
228  $this->configArray = ‪$configArray;
229  }
230 
234  public function ‪getConfigArray(): array
235  {
236  if ($this->configArray === null) {
237  throw new \RuntimeException(
238  'Setup "config." not initialized. FrontendTypoScriptFactory->createSetupConfigOrFullSetup() not called?',
239  1710666123
240  );
241  }
242  return ‪$this->configArray;
243  }
244 
248  public function ‪setPageTree(‪RootNode ‪$pageTree): void
249  {
250  $this->pageTree = ‪$pageTree;
251  }
252 
262  public function ‪getPageTree(): ‪RootNode
263  {
264  if ($this->pageTree === null) {
265  throw new \RuntimeException(
266  'PAGE node has not been initialized. This happens in cached Frontend scope where full TypoScript' .
267  ' is not needed by the system, and if a PAGE object for given type could not be determined.' .
268  ' Test with hasPage().',
269  1710399966
270  );
271  }
272  return ‪$this->pageTree;
273  }
274 
278  public function ‪hasPage(): bool
279  {
280  return $this->pageTree !== null;
281  }
282 
286  public function ‪setPageArray(array ‪$pageArray): void
287  {
288  $this->pageArray = ‪$pageArray;
289  }
290 
296  public function ‪getPageArray(): array
297  {
298  if ($this->pageArray === null) {
299  throw new \RuntimeException(
300  'PAGE array has not been initialized. This happens in cached Frontend scope where full TypoScript' .
301  ' is not needed by the system, and if a PAGE object for given type could not be determined.' .
302  ' Test with hasPage().',
303  1710399967
304  );
305  }
306  return ‪$this->pageArray;
307  }
308 }
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\$configArray
‪array $configArray
Definition: FrontendTypoScript.php:35
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\getSettingsConditionList
‪getSettingsConditionList()
Definition: FrontendTypoScript.php:62
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\getSetupArray
‪getSetupArray()
Definition: FrontendTypoScript.php:179
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\setSetupIncludeTree
‪setSetupIncludeTree(RootInclude $setupIncludeTree)
Definition: FrontendTypoScript.php:107
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\getPageArray
‪getPageArray()
Definition: FrontendTypoScript.php:296
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\getSetupTree
‪getSetupTree()
Definition: FrontendTypoScript.php:152
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\hasSetup
‪hasSetup()
Definition: FrontendTypoScript.php:144
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\getConfigTree
‪getConfigTree()
Definition: FrontendTypoScript.php:212
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\getConfigArray
‪getConfigArray()
Definition: FrontendTypoScript.php:234
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\$pageArray
‪array $pageArray
Definition: FrontendTypoScript.php:37
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\setConfigTree
‪setConfigTree(RootNode $setupConfig)
Definition: FrontendTypoScript.php:194
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\getPageTree
‪getPageTree()
Definition: FrontendTypoScript.php:262
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\$setupArray
‪array $setupArray
Definition: FrontendTypoScript.php:33
‪TYPO3\CMS\Core\TypoScript
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\getFlatSettings
‪getFlatSettings()
Definition: FrontendTypoScript.php:88
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\$setupIncludeTree
‪RootInclude $setupIncludeTree
Definition: FrontendTypoScript.php:31
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\hasPage
‪hasPage()
Definition: FrontendTypoScript.php:278
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\getSettingsTree
‪getSettingsTree()
Definition: FrontendTypoScript.php:51
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\getSetupIncludeTree
‪getSetupIncludeTree()
Definition: FrontendTypoScript.php:119
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\setPageArray
‪setPageArray(array $pageArray)
Definition: FrontendTypoScript.php:286
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\$setupTree
‪RootNode $setupTree
Definition: FrontendTypoScript.php:32
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\setSetupArray
‪setSetupArray(array $setupArray)
Definition: FrontendTypoScript.php:167
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\$pageTree
‪RootNode $pageTree
Definition: FrontendTypoScript.php:36
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\$configTree
‪RootNode $configTree
Definition: FrontendTypoScript.php:34
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\setConfigArray
‪setConfigArray(array $configArray)
Definition: FrontendTypoScript.php:226
‪TYPO3\CMS\Core\TypoScript\AST\Node\RootNode
Definition: RootNode.php:26
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\setPageTree
‪setPageTree(RootNode $pageTree)
Definition: FrontendTypoScript.php:248
‪TYPO3\CMS\Core\TypoScript\IncludeTree\IncludeNode\RootInclude
Definition: RootInclude.php:27
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\__construct
‪__construct(private readonly RootNode $settingsTree, private readonly array $settingsConditionList, private readonly array $flatSettings, private readonly array $setupConditionList,)
Definition: FrontendTypoScript.php:39
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript
Definition: FrontendTypoScript.php:30
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\setSetupTree
‪setSetupTree(RootNode $setupTree)
Definition: FrontendTypoScript.php:127
‪TYPO3\CMS\Core\TypoScript\FrontendTypoScript\getSetupConditionList
‪getSetupConditionList()
Definition: FrontendTypoScript.php:99