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

Public Member Functions

 setIdentifier (string $identifier)
 
 getIdentifier ()
 
 getName ()
 
 updateName (string $name)
 
 addChild (ChildNodeInterface $node)
 
 getChildByName (string $name)
 
 removeChildByName (string $name)
 
 hasChildren ()
 
iterable< ChildNodeInterfacegetNextChild ()
 
 sortChildren ()
 
 setValue (?string $value)
 
 appendValue (string $value)
 
 getValue ()
 
 isValueNull ()
 
 setPreviousValue (?string $value)
 
 getPreviousValue ()
 
 setOriginalValueTokenStream (?TokenStreamInterface $tokenStream)
 
 getOriginalValueTokenStream ()
 
 addComment (TokenStreamInterface $tokenStream)
 
TokenStreamInterface[] getComments ()
 
 toArray ()
 
 flatten (string $prefix='')
 

Detailed Description

The created AST consists of a NodeRoot object with nested NodeObject children. This is the main interface to any node type.

Example TypoScript: "foo = fooValue" "foo.bar = barValue" This creates a RootNode with one ChildNode name "foo" and value "fooValue", that has a child ChildNode name "bar" and value "barValue".

: Internal AST structure.

Definition at line 34 of file NodeInterface.php.

Member Function Documentation

◆ addChild()

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

◆ addComment()

TYPO3\CMS\Core\TypoScript\AST\Node\NodeInterface::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.

Implemented in TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode.

◆ appendValue()

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

◆ flatten()

TYPO3\CMS\Core\TypoScript\AST\Node\NodeInterface::flatten ( string  $prefix = '')

Flatten the tree. A RootNode with a ChildNode "foo" and value "fooValue", with this ChildNode again having a ChildNode "bar" and value "barValue" becomes: [ 'foo' => 'fooValue', 'foo.bar' => 'barValue', ]

Flattening a TypoScript tree is especially used for constants to quickly look up constants when parsing setup node value streams that use T_CONSTANT tokens.

Implemented in TYPO3\CMS\Core\TypoScript\AST\Node\RootNode, and TYPO3\CMS\Core\TypoScript\AST\Node\AbstractChildNode.

◆ getChildByName()

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

◆ getComments()

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

◆ getIdentifier()

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

◆ getName()

◆ getNextChild()

◆ getOriginalValueTokenStream()

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

◆ getPreviousValue()

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

◆ getValue()

◆ hasChildren()

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

◆ isValueNull()

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

◆ removeChildByName()

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

◆ setIdentifier()

TYPO3\CMS\Core\TypoScript\AST\Node\NodeInterface::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.

Implemented in TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode.

◆ setOriginalValueTokenStream()

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

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

Implemented in TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode.

◆ setPreviousValue()

TYPO3\CMS\Core\TypoScript\AST\Node\NodeInterface::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.

Implemented in TYPO3\CMS\Core\TypoScript\AST\Node\AbstractNode.

◆ setValue()

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

◆ sortChildren()

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

◆ toArray()

TYPO3\CMS\Core\TypoScript\AST\Node\NodeInterface::toArray ( )

b/w compat method to turn AST into an array. Note we're NOT using magic __toArray() here to avoid calling array-cast of AST by accident: toArray() should be called explicitly if needed, which makes it much easier to drop this b/w compat method when we later want to drop that layer.

Note RootNode always returns an array, while ObjectNode's may return null.

Implemented in TYPO3\CMS\Core\TypoScript\AST\Node\AbstractChildNode.

◆ updateName()

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