ConditionInclude

final class \TYPO3\CMS\Core\TypoScript\IncludeTree\IncludeNode\ConditionInclude

Extends
AbstractConditionInclude

A node representing a condition and its body.

[foo = bar] baz = bazValue [END]

Tags

internal:

Internal tree structure.

Table of Contents

Properties

$children  : array<int, IncludeInterface>
$clear  : bool
$conditionValueToken  : Token
$isSplit  : bool
$lineStream  : LineStream|null
$name  : string
$originalConditionValueToken  : Token|null
$originalTokenLine  : LineInterface|null
$path  : string
$pid  : int|null
$root  : bool
$verdict  : bool

Methods

__serialize()  : array
When storing to cache, we only store FE relevant properties and skip things like "name", "identifier" and friends. We also don't need the LineStream when a node is split.
addChild()  : void
Child maintenance methods.
getConditionToken()  : Token
getConditionVerdict()  : bool
getIdentifier()  : string
getLineStream()  : LineStream|null
getName()  : string
getNextChild()  : iterable<string|int, IncludeInterface>
getOriginalConditionToken()  : Token|null
getOriginalLine()  : LineInterface|null
getPath()  : string
getPid()  : int|null
getType()  : string
A human-readable string derived from class name - Used in BE template analyzer
hasChildren()  : bool
isClear()  : bool
isConditionNegated()  : bool
True for ConditionElseInclude: The [ELSE] node of a condition.
isRoot()  : bool
isSplit()  : bool
isSysTemplateRecord()  : bool
True for IncludeTypoScriptInclude - this node represents a sys_template record.
setClear()  : void
Set to true for IncludeTypoScriptInclude's (sys_template records) when "clear constants" or "clear setup" is set. Depends on context if currently constants or setup are parsed.
setConditionToken()  : void
Set and get the condition token: "[foo = bar]"
setConditionVerdict()  : void
When a condition is evaluated, this is set to true of false depending on the condition result.
setIdentifier()  : void
An identifier for this include. Typically, a hash of some kind. This identifier is unique within the tree, by being created from the parent identifier plus something unique for this level like a counter. This identifier is used in the backend, when referencing single includes to be rendered.
setLineStream()  : void
The source split into single lines by a tokenizer.
setName()  : void
A human-readable version of the identifier: Used in backend tree rendering.
setOriginalConditionToken()  : void
Conditions may use constants: "[foo = {$bar}]". This getter/setter allows storing the original condition token string.
setOriginalLine()  : void
When an imports are handled, such a line is substituted by the included content. To be able to still output the original line, it is parked here.
setPath()  : void
This is set to a non-empty string for includes that represent files. The file location is stored here, typically something like "EXT:my_extension/path/to/foo.typoscript".
setPid()  : void
Set to the pid of IncludeTypoScriptInclude's (sys_template records). Relevant in backend tree rendering only.
setRoot()  : void
Set to true for IncludeTypoScriptInclude's (sys_template records) when "root" flag is set.
setSplit()  : void
When included line streams contain conditions or imports, the node is split into children that contain single segments of the source. The node itself is then just a container and the LineStream attached is irrelevant for further processing.
serialize()  : array
Add the condition token to cache when serialized. See __serialize() of AbstractInclude.

Properties

$originalConditionValueToken

protected Token|null $originalConditionValueToken = null

Methods

__serialize()

When storing to cache, we only store FE relevant properties and skip things like "name", "identifier" and friends. We also don't need the LineStream when a node is split.

public final __serialize() : array

Return values

array

getConditionVerdict()

public getConditionVerdict() : bool

Return values

bool

getIdentifier()

public getIdentifier() : string

Return values

string

getName()

public getName() : string

Return values

string

getOriginalConditionToken()

public getOriginalConditionToken() : Token|null

Return values

Token|null

getPath()

public getPath() : string

Return values

string

getPid()

public getPid() : int|null

Return values

int|null

getType()

A human-readable string derived from class name - Used in BE template analyzer

public getType() : string

Return values

string

hasChildren()

public hasChildren() : bool

Return values

bool

isClear()

public isClear() : bool

Return values

bool

isConditionNegated()

True for ConditionElseInclude: The [ELSE] node of a condition.

public isConditionNegated() : bool

Return values

bool

isRoot()

public isRoot() : bool

Return values

bool

isSplit()

public isSplit() : bool

Return values

bool

isSysTemplateRecord()

True for IncludeTypoScriptInclude - this node represents a sys_template record.

public isSysTemplateRecord() : bool

When true, methods like isRoot() and isClear() are relevant.

Return values

bool

setClear()

Set to true for IncludeTypoScriptInclude's (sys_template records) when "clear constants" or "clear setup" is set. Depends on context if currently constants or setup are parsed.

public setClear(bool $clear) : void

Parameters

$clear : bool

setConditionToken()

Set and get the condition token: "[foo = bar]"

public setConditionToken(Token $token) : void

Parameters

$token : Token

setConditionVerdict()

When a condition is evaluated, this is set to true of false depending on the condition result.

public setConditionVerdict(bool $verdict) : void

Parameters

$verdict : bool

setIdentifier()

An identifier for this include. Typically, a hash of some kind. This identifier is unique within the tree, by being created from the parent identifier plus something unique for this level like a counter. This identifier is used in the backend, when referencing single includes to be rendered.

public setIdentifier(string $identifier) : void

Calculating identifiers is initiated by calling setIdentifier() on RootNode, which will recurse the tree. Call this on the final tree, after include calculation finished, so include building itself does not need to fiddle with identifier updates. Note this value is skipped when persisting to caches since it's a Backend related thing that does not use cached context: When retrieving includes from cache (e.g. in Frontend), the identifier is null and calling the getter will throw an exception.

Parameters

$identifier : string

setLineStream()

The source split into single lines by a tokenizer.

public setLineStream(LineStream|null $lineStream) : void

Parameters

$lineStream : LineStream|null

setName()

A human-readable version of the identifier: Used in backend tree rendering.

public setName(string $name) : void

Parameters

$name : string

setOriginalConditionToken()

Conditions may use constants: "[foo = {$bar}]". This getter/setter allows storing the original condition token string.

public setOriginalConditionToken(Token $token) : void

This is set in backend only in case a constant substitution has taken place. Otherwise, the "vanilla" condition token is identical, getOriginalConditionToken() returns null and the condition token should be fetched from getConditionToken().

Parameters

$token : Token

setOriginalLine()

When an imports are handled, such a line is substituted by the included content. To be able to still output the original line, it is parked here.

public setOriginalLine(LineInterface $line) : void

Relevant in backend tree and source display only.

Parameters

$line : LineInterface

setPath()

This is set to a non-empty string for includes that represent files. The file location is stored here, typically something like "EXT:my_extension/path/to/foo.typoscript".

public setPath(string $path) : void

This is used when resolving file includes relative to a parent include, so a potential child node knows where to look relative to its parent path. Note this value is skipped when persisting to caches: The parent path information is no longer needed when a tree is fetched from cache since all children were attached already and don't need to be recalculated depending on their parent path value.

Parameters

$path : string

setPid()

Set to the pid of IncludeTypoScriptInclude's (sys_template records). Relevant in backend tree rendering only.

public setPid(int $pid) : void

Parameters

$pid : int

setRoot()

Set to true for IncludeTypoScriptInclude's (sys_template records) when "root" flag is set.

public setRoot(bool $root) : void

Parameters

$root : bool

setSplit()

When included line streams contain conditions or imports, the node is split into children that contain single segments of the source. The node itself is then just a container and the LineStream attached is irrelevant for further processing.

public setSplit() : void

This flag is set when a line stream is split and the children fully represent the source.

serialize()

Add the condition token to cache when serialized. See __serialize() of AbstractInclude.

protected serialize() : array

Return values

array
On this page