FrontendTypoScript

final class \TYPO3\CMS\Core\TypoScript\FrontendTypoScript

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

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

Table of Contents

Methods

__construct()  : mixed
getConfigArray()  : array
Array representation of getConfigTree().
getConfigTree()  : RootNode
The merged TypoScript 'config.'.
getFlatSettings()  : array
This is *always* set up by the middleware / factory: Current settings ("constants") are needed for page cache identifier calculation.
getPageArray()  : array
Array representation of getPageTree().
getPageTree()  : RootNode
The determined PAGE object from main TypoScript 'setup' that depends on type / typeNum.
getSettingsConditionList()  : array
List of settings conditions with verdicts. Used internally for page cache identifier calculation.
getSettingsTree()  : RootNode
The settings ("constants") AST.
getSetupArray()  : array
The full Frontend TypoScript array.
getSetupConditionList()  : array
List of setup conditions with verdicts. Used internally for page cache identifier calculation.
getSetupIncludeTree()  : RootInclude|null
A tree of all TypoScript setup includes. Used internally within FrontendTypoScriptFactory to suppress calculating the include tree twice.
getSetupTree()  : RootNode
hasPage()  : bool
hasSetup()  : bool
When a page is retrieved from cache and does not contain COA_INT or USER_INT objects, Frontend TypoScript setup is not calculated, AST and the array representation aren't set.
setConfigArray()  : void
setConfigTree()  : void
setPageArray()  : void
setPageTree()  : void
setSetupArray()  : void
setSetupIncludeTree()  : void
setSetupTree()  : void

Methods

__construct()

public __construct(RootNode $settingsTree, array $settingsConditionList, array $flatSettings, array $setupConditionList) : mixed

Parameters

$settingsTree : RootNode
$settingsConditionList : array
$flatSettings : array
$setupConditionList : array

getConfigArray()

Array representation of getConfigTree().

public getConfigArray() : array

Return values

array

getConfigTree()

The merged TypoScript 'config.'.

public getConfigTree() : RootNode

This is the result of the "global" TypoScript 'config' section, merged with the 'config' section of the determined PAGE object which can override "global" 'config' per type / typeNum.

This is always needed within casual Frontend rendering by FrontendTypoScriptFactory and has a dedicated cache layer to be quick to retrieve. It is needed even in fully cached pages context to for instance know if debug headers should be added ("config.debug=1") to a response.

Return values

RootNode

getFlatSettings()

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

public getFlatSettings() : array

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',
];

Return values

array

getPageArray()

Array representation of getPageTree().

public getPageArray() : array

Return values

array

getPageTree()

The determined PAGE object from main TypoScript 'setup' that depends on type / typeNum.

public getPageTree() : RootNode

This is used internally by RequestHandler for page generation. It is not set in full cached page scenarios without _INT object.

Return values

RootNode

getSettingsConditionList()

List of settings conditions with verdicts. Used internally for page cache identifier calculation.

public getSettingsConditionList() : array

Return values

array

getSettingsTree()

The settings ("constants") AST.

public getSettingsTree() : RootNode

Return values

RootNode

getSetupArray()

The full Frontend TypoScript array.

public getSetupArray() : 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.

Return values

array

getSetupConditionList()

List of setup conditions with verdicts. Used internally for page cache identifier calculation.

public getSetupConditionList() : array

Return values

array

getSetupIncludeTree()

A tree of all TypoScript setup includes. Used internally within FrontendTypoScriptFactory to suppress calculating the include tree twice.

public getSetupIncludeTree() : RootInclude|null

Return values

RootInclude|null

getSetupTree()

public getSetupTree() : RootNode

Return values

RootNode

hasPage()

public hasPage() : bool

Return values

bool

hasSetup()

When a page is retrieved from cache and does not contain COA_INT or USER_INT objects, Frontend TypoScript setup is not calculated, AST and the array representation aren't set.

public hasSetup() : bool

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.

Return values

bool

setConfigArray()

public setConfigArray(array $configArray) : void

Parameters

$configArray : array

setPageArray()

public setPageArray(array $pageArray) : void

Parameters

$pageArray : array

setSetupArray()

public setSetupArray(array $setupArray) : void

Parameters

$setupArray : array
On this page