ConditionElseInclude extends AbstractConditionInclude
A node representing the [ELSE] body of a condition:
[foo = bar] ... [ELSE] baz = bazValue
The LineStream is the body of the else block, the condition token is set to the token of the condition "[foo = bar]".
Tags
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<string|int, mixed>
- 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 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<string|int, mixed>
- Add the condition token to cache when serialized. See __serialize() of AbstractInclude.
Properties
$children
protected
array<int, IncludeInterface>
$children
= []
$clear
protected
bool
$clear
= false
$conditionValueToken
protected
Token
$conditionValueToken
$isSplit
protected
bool
$isSplit
= false
$lineStream
protected
LineStream|null
$lineStream
= null
$name
protected
string
$name
= ''
$originalConditionValueToken
protected
Token|null
$originalConditionValueToken
= null
$originalTokenLine
protected
LineInterface|null
$originalTokenLine
= null
$path
protected
string
$path
= ''
$pid
protected
int|null
$pid
= null
$root
protected
bool
$root
= false
$verdict
protected
bool
$verdict
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<string|int, mixed>
Return values
array<string|int, mixed>addChild()
Child maintenance methods.
public
addChild(IncludeInterface $node) : void
Parameters
- $node : IncludeInterface
getConditionToken()
public
getConditionToken() : Token
Return values
TokengetConditionVerdict()
public
getConditionVerdict() : bool
Return values
boolgetIdentifier()
public
getIdentifier() : string
Return values
stringgetLineStream()
public
getLineStream() : LineStream|null
Return values
LineStream|nullgetName()
public
getName() : string
Return values
stringgetNextChild()
public
getNextChild() : iterable<string|int, IncludeInterface>
Return values
iterable<string|int, IncludeInterface>getOriginalConditionToken()
public
getOriginalConditionToken() : Token|null
Return values
Token|nullgetOriginalLine()
public
getOriginalLine() : LineInterface|null
Return values
LineInterface|nullgetPath()
public
getPath() : string
Return values
stringgetPid()
public
getPid() : int|null
Return values
int|nullgetType()
A human-readable string derived from class name - Used in BE template analyzer
public
getType() : string
Return values
stringhasChildren()
public
hasChildren() : bool
Return values
boolisClear()
public
isClear() : bool
Return values
boolisConditionNegated()
True for ConditionElseInclude: The [ELSE] node of a condition.
public
isConditionNegated() : bool
Return values
boolisRoot()
public
isRoot() : bool
Return values
boolisSplit()
public
isSplit() : bool
Return values
boolisSysTemplateRecord()
True for IncludeTypoScriptInclude - this node represents a sys_template record.
public
isSysTemplateRecord() : bool
When true, methods like isRoot() and isClear() are relevant.
Return values
boolsetClear()
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 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<string|int, mixed>