IncludeTreeCommentAwareAstBuilderVisitor implements IncludeTreeVisitorInterface
Secondary visitor that creates the TypoScript AST: When adding this visitor and traversing the IncludeTree, the final AST can be fetched using getAst().
This is an "extended" version of IncludeTreeAstBuilderVisitor that uses the CommentAwareAstBuilder instead of the AstBuilder to build the AST: This special AST builder is comment aware and adds TypoScript comments to nodes.
This visitor is used in ext:tstemplate TypoScript modules and ext:backend page TSconfig to allow implementation of the "comment" related functionality.
When parsing "setup", "flattened" constants should be assigned to this visitor, so the AstBuilder can resolve constants.
Tags
Attributes
- #[Autoconfigure]
- $public: true
- $shared: false
Table of Contents
Interfaces
- IncludeTreeVisitorInterface
- A visitor that can be attached to IncludeTreeTraverser's.
Methods
- __construct() : mixed
- getAst() : RootNode
- setFlatConstants() : void
- When 'setup' is parsed, setting resolved flat constants here will make the AST builder substitute these constants.
- visit() : void
- Main visit method called for each node.
- visitBeforeChildren() : void
- Gets called by the traversers *before* children are traversed. Useful for instance for the IncludeTreeConditionMatcherVisitor to evaluate a condition verdict *before* children are traversed (or not).
Methods
__construct()
    public
                    __construct(CommentAwareAstBuilder $astBuilder) : mixed
    Parameters
- $astBuilder : CommentAwareAstBuilder
getAst()
    public
                    getAst() : RootNode
    Return values
RootNodesetFlatConstants()
When 'setup' is parsed, setting resolved flat constants here will make the AST builder substitute these constants.
    public
                    setFlatConstants(array<string, string> $flatConstants) : void
    Parameters
- $flatConstants : array<string, string>
visit()
Main visit method called for each node.
    public
                    visit(IncludeInterface $include, int $currentDepth) : void
    Parameters
- $include : IncludeInterface
- $currentDepth : int
visitBeforeChildren()
Gets called by the traversers *before* children are traversed. Useful for instance for the IncludeTreeConditionMatcherVisitor to evaluate a condition verdict *before* children are traversed (or not).
    public
                    visitBeforeChildren(IncludeInterface $include, int $currentDepth) : void
    Parameters
- $include : IncludeInterface
- $currentDepth : int