‪TYPO3CMS  ‪main
TYPO3\CMS\Core\TypoScript\AST\Event\EvaluateModifierFunctionEvent Class Reference

Public Member Functions

 __construct (private readonly string $functionName, private readonly ?string $functionArgument, private readonly ?string $originalValue,)
 
 getFunctionName ()
 
 getFunctionArgument ()
 
 getOriginalValue ()
 
 setValue (string $value)
 
 getValue ()
 

Private Attributes

string $value = null
 

Detailed Description

Listeners to this event are able to implement own ":=" TypoScript modifier functions, example:

foo = myOriginalValue foo := myNewFunction(myFunctionArgument)

Listeners should take care function names can not overlap with function names from other extensions and should thus namespace, example naming: "extNewsSortFunction()"

Definition at line 29 of file EvaluateModifierFunctionEvent.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\TypoScript\AST\Event\EvaluateModifierFunctionEvent::__construct ( private readonly string  $functionName,
private readonly ?string  $functionArgument,
private readonly ?string  $originalValue 
)

Definition at line 33 of file EvaluateModifierFunctionEvent.php.

Member Function Documentation

◆ getFunctionArgument()

TYPO3\CMS\Core\TypoScript\AST\Event\EvaluateModifierFunctionEvent::getFunctionArgument ( )

Optional function argument, for example "myArgument" when using "foo := extNewsSortFunction(myArgument)"

Definition at line 50 of file EvaluateModifierFunctionEvent.php.

Referenced by TYPO3Tests\TestTyposcriptAstFunctionEvent\EventListener\TyposcriptTestFunction\__invoke().

◆ getFunctionName()

TYPO3\CMS\Core\TypoScript\AST\Event\EvaluateModifierFunctionEvent::getFunctionName ( )

The function name, for example "extNewsSortFunction" when using "foo := extNewsSortFunction()"

Definition at line 42 of file EvaluateModifierFunctionEvent.php.

Referenced by TYPO3Tests\TestTyposcriptAstFunctionEvent\EventListener\TyposcriptTestFunction\__invoke().

◆ getOriginalValue()

TYPO3\CMS\Core\TypoScript\AST\Event\EvaluateModifierFunctionEvent::getOriginalValue ( )

Original / current value, for example "fooValue" when using: foo = fooValue foo := extNewsSortFunction(myArgument)

Definition at line 60 of file EvaluateModifierFunctionEvent.php.

Referenced by TYPO3Tests\TestTyposcriptAstFunctionEvent\EventListener\TyposcriptTestFunction\__invoke().

◆ getValue()

TYPO3\CMS\Core\TypoScript\AST\Event\EvaluateModifierFunctionEvent::getValue ( )

Used by AstBuilder to fetch the updated value, falls back to given original value. Can be used by Listeners to see if a previous listener changed the value already by comparing with getOriginalValue().

Definition at line 80 of file EvaluateModifierFunctionEvent.php.

References TYPO3\CMS\Core\TypoScript\AST\Event\EvaluateModifierFunctionEvent\$value.

◆ setValue()

TYPO3\CMS\Core\TypoScript\AST\Event\EvaluateModifierFunctionEvent::setValue ( string  $value)

Set the updated value calculated by a listener. Note you can not set to null to "unset", since getValue() falls back to originalValue in this case. Set to empty string instead for this edge case.

Definition at line 70 of file EvaluateModifierFunctionEvent.php.

References TYPO3\CMS\Core\TypoScript\AST\Event\EvaluateModifierFunctionEvent\$value.

Referenced by TYPO3Tests\TestTyposcriptAstFunctionEvent\EventListener\TyposcriptTestFunction\__invoke().

Member Data Documentation

◆ $value

string TYPO3\CMS\Core\TypoScript\AST\Event\EvaluateModifierFunctionEvent::$value = null
private