‪TYPO3CMS  ‪main
TYPO3\CMS\Core\TypoScript\FrontendTypoScript Class Reference

Public Member Functions

 __construct (private readonly RootNode $settingsTree, private readonly array $flatSettings,)
 getSettingsTree ()
 getFlatSettings ()
 setSetupTree (RootNode $setupTree)
 hasSetup ()
 getSetupTree ()
 setSetupArray (array $setupArray)
 getSetupArray ()

Private Attributes

RootNode null $setupTree = null
array null $setupArray = null

Detailed Description

This class contains the TypoScript set up by the PrepareTypoScriptFrontendRendering Frontend middleware. It can be accessed in content objects:

$frontendTypoScript = $request->getAttribute('frontend.typoscript');

Definition at line 28 of file FrontendTypoScript.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\TypoScript\FrontendTypoScript::__construct ( private readonly RootNode  $settingsTree,
private readonly array  $flatSettings 

Definition at line 33 of file FrontendTypoScript.php.

Member Function Documentation

◆ getFlatSettings()

TYPO3\CMS\Core\TypoScript\FrontendTypoScript::getFlatSettings ( )

This is always set up by the middleware: Current settings (aka "TypoScript constants") are needed for page cache identifier calculation.

This is a "flattened" array of all settings, as example, consider these settings TypoScript:

mySettings {
foo = fooValue
bar = barValue

This will result in this array:

$flatSettings = [
'mySettings.foo' => 'fooValue',
'mySettings.bar' => 'barValue',

Definition at line 68 of file FrontendTypoScript.php.

◆ getSettingsTree()

TYPO3\CMS\Core\TypoScript\FrontendTypoScript::getSettingsTree ( )

Internal for now until the AST API stabilized.

Definition at line 41 of file FrontendTypoScript.php.

◆ getSetupArray()

TYPO3\CMS\Core\TypoScript\FrontendTypoScript::getSetupArray ( )

The full Frontend TypoScript array.

This is always set up as soon as the Frontend rendering needs to actually render something and can not get the full content from page cache. This is the case when a page cache entry does not exist, or when the page contains COA_INT or USER_INT objects.

Definition at line 126 of file FrontendTypoScript.php.

References TYPO3\CMS\Core\TypoScript\FrontendTypoScript\$setupArray.

◆ getSetupTree()

TYPO3\CMS\Core\TypoScript\FrontendTypoScript::getSetupTree ( )

Internal for now until the AST API stabilized.

Definition at line 99 of file FrontendTypoScript.php.

References TYPO3\CMS\Core\TypoScript\FrontendTypoScript\$setupTree.

◆ hasSetup()

TYPO3\CMS\Core\TypoScript\FrontendTypoScript::hasSetup ( )

When a page is retrieved from cache and does not contain COA_INT or USER_INT objects, Frontend TypoScript setup is not calculated, so the AST and the array are not set. Calling getSetupTree() or getSetupArray() will then throw an exception.

To avoid the exception, consumers can call hasSetup() beforehand.

Note casual content objects do not need to do this, since setup TypoScript is always set up when content objects need to be calculated.

Definition at line 91 of file FrontendTypoScript.php.

◆ setSetupArray()

TYPO3\CMS\Core\TypoScript\FrontendTypoScript::setSetupArray ( array  $setupArray)

◆ setSetupTree()

TYPO3\CMS\Core\TypoScript\FrontendTypoScript::setSetupTree ( RootNode  $setupTree)

Member Data Documentation

◆ $setupArray

array null TYPO3\CMS\Core\TypoScript\FrontendTypoScript::$setupArray = null

◆ $setupTree

RootNode null TYPO3\CMS\Core\TypoScript\FrontendTypoScript::$setupTree = null