FrontendTypoScript

FinalYes

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
getFlatSettings()  : array<string|int, mixed>
This is *always* set up by the middleware: Current settings (aka "TypoScript constants") are needed for page cache identifier calculation.
getSettingsTree()  : RootNode
getSetupArray()  : array<string|int, mixed>
The full Frontend TypoScript array.
getSetupTree()  : RootNode
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, so the AST and the array are not set.
setSetupArray()  : void
setSetupTree()  : void

Methods

__construct()

public __construct(RootNode $settingsTree, array<string|int, mixed> $flatSettings) : mixed
Parameters
$settingsTree : RootNode
$flatSettings : array<string|int, mixed>

getFlatSettings()

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

public getFlatSettings() : array<string|int, mixed>

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<string|int, mixed>

getSettingsTree()

public getSettingsTree() : RootNode
Internal

Internal for now until the AST API stabilized.

Return values
RootNode

getSetupArray()

The full Frontend TypoScript array.

public getSetupArray() : array<string|int, mixed>

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<string|int, mixed>

getSetupTree()

public getSetupTree() : RootNode
Internal

Internal for now until the AST API stabilized.

Return values
RootNode

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.

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

setSetupArray()

public setSetupArray(array<string|int, mixed> $setupArray) : void
Parameters
$setupArray : array<string|int, mixed>
Internal

        
On this page

Search results