‪TYPO3CMS  ‪main
TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode Class Reference
Inheritance diagram for TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode:
TYPO3\CMS\Core\TypoScript\AST\Node\NodeInterface TYPO3\CMS\Core\TypoScript\AST\Node\AbstractChildNode TYPO3\CMS\Core\TypoScript\AST\Node\RootNode TYPO3\CMS\Core\TypoScript\AST\Node\ChildNode TYPO3\CMS\Core\TypoScript\AST\Node\ReferenceChildNode

Public Member Functions

 __serialize ()
 
 setIdentifier (string $identifier)
 
 updateName (string $name)
 
 getIdentifier ()
 
 addChild (ChildNodeInterface $node)
 
 getChildByName (string $name)
 
 removeChildByName (string $name)
 
 hasChildren ()
 
 getNextChild ()
 
 sortChildren ()
 
 setValue (?string $value)
 
 appendValue (string $value)
 
 getValue ()
 
 isValueNull ()
 
 setPreviousValue (?string $value)
 
 getPreviousValue ()
 
 setOriginalValueTokenStream (?TokenStreamInterface $tokenStream)
 
 getOriginalValueTokenStream ()
 
 addComment (TokenStreamInterface $tokenStream)
 
TokenStreamInterface[] getComments ()
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Core\TypoScript\AST\Node\NodeInterface
 getName ()
 
 toArray ()
 
 flatten (string $prefix='')
 

Protected Member Functions

 serialize ()
 

Protected Attributes

string $name
 
array $children = []
 

Private Attributes

string $identifier = null
 
string $value = null
 
string $previousValue = null
 
TokenStreamInterface $originalValueTokenStream = null
 
array $comments = []
 

Detailed Description

Generic node. Implements common methods of NodeInterface used in all Node classes.

: Internal AST structure.

Definition at line 28 of file AbstractNode.php.

Member Function Documentation

◆ __serialize()

TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::__serialize ( )
final

When storing to cache, we only store FE relevant properties and skip various BE related properties which then default to class defaults when unserialized. This is done to create smaller php cache files.

Definition at line 47 of file AbstractNode.php.

References TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode\serialize().

◆ addChild()

TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::addChild ( ChildNodeInterface  $node)

Helper methods to operate on children.

Implements TYPO3\CMS\Core\TypoScript\AST\Node\NodeInterface.

Definition at line 98 of file AbstractNode.php.

References TYPO3\CMS\Core\TypoScript\AST\Node\NodeInterface\getName().

◆ addComment()

TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::addComment ( TokenStreamInterface  $tokenStream)

Helper methods to attach TypoScript tokens to a node. This is used in ext:tstemplate "Constant Editor" and "Object Browser" and handled by CommentAwareAstBuilder.

Implements TYPO3\CMS\Core\TypoScript\AST\Node\NodeInterface.

Definition at line 173 of file AbstractNode.php.

Referenced by TYPO3\CMS\Core\TypoScript\AST\CommentAwareAstBuilder\build().

◆ appendValue()

TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::appendValue ( string  $value)

◆ getChildByName()

TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::getChildByName ( string  $name)

◆ getComments()

TokenStreamInterface [] TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::getComments ( )

◆ getIdentifier()

TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::getIdentifier ( )

◆ getNextChild()

◆ getOriginalValueTokenStream()

TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::getOriginalValueTokenStream ( )

◆ getPreviousValue()

TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::getPreviousValue ( )

◆ getValue()

TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::getValue ( )

◆ hasChildren()

TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::hasChildren ( )

◆ isValueNull()

TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::isValueNull ( )

◆ removeChildByName()

TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::removeChildByName ( string  $name)

Note this does not choke if that child does not exist, so we can "blindly" remove without error.

Implements TYPO3\CMS\Core\TypoScript\AST\Node\NodeInterface.

Definition at line 111 of file AbstractNode.php.

References TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode\$name.

◆ serialize()

◆ setIdentifier()

TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::setIdentifier ( string  $identifier)

An identifier for this node. Typically, a hash of some kind. This identifier is unique within the tree, by being created from the parent identifier plus the name. This identifier is used in the backend, when referencing single nodes. Calculating identifiers is initiated by calling setIdentifier() on RootNode, which will recurse the tree. Call this on the final tree, after AST calculation finished, so AST building itself does not need to fiddle with identifier updates when for instance tree parts are cloned using '<' operator. Note this value is skipped when persisting to caches since it's a Backend related thing that does not use cached context: When retrieving nodes from cache (e.g. in Frontend), the identifier is null and calling the getter will throw an exception.

Implements TYPO3\CMS\Core\TypoScript\AST\Node\NodeInterface.

Definition at line 64 of file AbstractNode.php.

References TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode\$identifier, and TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode\getNextChild().

◆ setOriginalValueTokenStream()

TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::setOriginalValueTokenStream ( ?TokenStreamInterface  $tokenStream)

Helper method for backend object browser to retrieve the original stream when a constant substitution happened, only set by CommentAwareAstBuilder.

Implements TYPO3\CMS\Core\TypoScript\AST\Node\NodeInterface.

Definition at line 163 of file AbstractNode.php.

◆ setPreviousValue()

TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::setPreviousValue ( ?string  $value)

Previous value is only set by comment aware ast builder. It is used in constant editor to see if a value has been changed.

Implements TYPO3\CMS\Core\TypoScript\AST\Node\NodeInterface.

Definition at line 153 of file AbstractNode.php.

References TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode\$value.

◆ setValue()

TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::setValue ( ?string  $value)

◆ sortChildren()

TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::sortChildren ( )

◆ updateName()

TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::updateName ( string  $name)

This forces $this->name NOT to be readonly. Used with '<' operator on tree root to copy: foo = value bar < foo The 'foo' object node is copied, but added to AST as name 'bar'

Implements TYPO3\CMS\Core\TypoScript\AST\Node\NodeInterface.

Reimplemented in TYPO3\CMS\Core\TypoScript\AST\Node\RootNode.

Definition at line 81 of file AbstractNode.php.

References TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode\$name.

Member Data Documentation

◆ $children

array TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::$children = []
protected

◆ $comments

array TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::$comments = []
private

◆ $identifier

string TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::$identifier = null
private

◆ $name

◆ $originalValueTokenStream

TokenStreamInterface TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::$originalValueTokenStream = null
private

◆ $previousValue

string TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode::$previousValue = null
private

◆ $value