‪TYPO3CMS  ‪main
TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeAstBuilderVisitor Class Reference
Inheritance diagram for TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeAstBuilderVisitor:
TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeVisitorInterface

Public Member Functions

 __construct (private readonly AstBuilderInterface $astBuilder)
 
 setFlatConstants (array $flatConstants)
 
 getAst ()
 
 visitBeforeChildren (IncludeInterface $include, int $currentDepth)
 
 visit (IncludeInterface $include, int $currentDepth)
 

Private Attributes

RootNode $ast
 
array $flatConstants = []
 

Detailed Description

Main visitor that creates the TypoScript AST: When adding this visitor and traversing the IncludeTree, the final AST can be fetched using getAst().

This visitor is usually only used together with ConditionVerdictAwareIncludeTreeTraverser, and the IncludeTreeConditionMatcherVisitor is added before this visitor to determine condition verdicts, so AST is only extended for conditions with "true" verdict.

When parsing "setup", "flattened" constants should be assigned to this visitor, so the AstBuilder can resolve constants.

: Internal tree structure.

Definition at line 38 of file IncludeTreeAstBuilderVisitor.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeAstBuilderVisitor::__construct ( private readonly AstBuilderInterface  $astBuilder)

Definition at line 47 of file IncludeTreeAstBuilderVisitor.php.

Member Function Documentation

◆ getAst()

TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeAstBuilderVisitor::getAst ( )

◆ setFlatConstants()

TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeAstBuilderVisitor::setFlatConstants ( array  $flatConstants)

When 'setup' is parsed, setting resolved flat constants here will make the AST builder substitute these constants.

Parameters
array<string,string>‪$flatConstants

Definition at line 58 of file IncludeTreeAstBuilderVisitor.php.

References TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeAstBuilderVisitor\$flatConstants.

◆ visit()

TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeAstBuilderVisitor::visit ( IncludeInterface  $include,
int  $currentDepth 
)

◆ visitBeforeChildren()

TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeAstBuilderVisitor::visitBeforeChildren ( IncludeInterface  $include,
int  $currentDepth 
)

Reset AST if "clear" flag is set. That's a sys_template record specific thing to restart with a new RootNode and drop any AST calculated already.

Implements TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeVisitorInterface.

Definition at line 72 of file IncludeTreeAstBuilderVisitor.php.

References TYPO3\CMS\Core\TypoScript\IncludeTree\IncludeNode\IncludeInterface\isClear().

Member Data Documentation

◆ $ast

RootNode TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeAstBuilderVisitor::$ast
private

◆ $flatConstants

array TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeAstBuilderVisitor::$flatConstants = []
private