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

Public Member Functions

 setFlattenedConstants (array $flattenedConstants)
 
 visitBeforeChildren (IncludeInterface $include, int $currentDepth)
 
 visit (IncludeInterface $include, int $currentDepth)
 

Private Attributes

array $flattenedConstants
 

Detailed Description

Handle constants within (TS setup) conditions: When a conditional include is like this: '["{$foo.bar}" == "4711"]', this visitor looks up 'foo.bar in given (flattened) constants and substitutes it with the constant value. The 'include' object then contains the substituted condition token for 'getConditionToken()', while the original token without the substitution is parked in 'getOriginalConditionToken()'. The latter is done to have the original token available in the backend to show, it is irrelevant in frontend.

: Internal tree structure.

Definition at line 35 of file IncludeTreeSetupConditionConstantSubstitutionVisitor.php.

Member Function Documentation

◆ setFlattenedConstants()

TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeSetupConditionConstantSubstitutionVisitor::setFlattenedConstants ( array  $flattenedConstants)

Must be set when adding this visitor, to an empty array at least. Will fatal otherwise, and that's fine, since if not setting this, this visitor is useless and shouldn't be added at all.

Parameters
array<string,string>‪$flattenedConstants

Definition at line 49 of file IncludeTreeSetupConditionConstantSubstitutionVisitor.php.

References TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeSetupConditionConstantSubstitutionVisitor\$flattenedConstants.

◆ visit()

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

◆ visitBeforeChildren()

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

Do the magic, see tests for details. Implementation within 'visitBeforeChildren()' since this allows running both this visitor first, and then IncludeTreeConditionMatcherVisitor directly afterward in the same traverser cycle!

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

Definition at line 60 of file IncludeTreeSetupConditionConstantSubstitutionVisitor.php.

References TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeSetupConditionConstantSubstitutionVisitor\$flattenedConstants.

Member Data Documentation

◆ $flattenedConstants