Feature: #98016 - PSR-14 EvaluateModifierFunctionEvent

See forge#98016


A new PSR-14 event \TYPO3\CMS\Core\TypoScript\AST\Event\EvaluateModifierFunctionEvent has been introduced which allows own TypoScript functions using the := operator.

This is a substitution of the old $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsparser.php']['preParseFunc'] hook as described in this Changelog.


The TYPO3 Core tests come with test extension EXT:core/Tests/Functional/Fixtures/Extensions/test_typoscript_ast_function_event to functional test the new event. The extension implements an example listener that can be used as boilerplate.

A simple TypoScript example looks like this:

someIdentifier = originalValue
someIdentifier := myModifierFunction(myFunctionArgument)

To implement myModifierFunction, an extension needs to register an event listener in file Configuration/Services.yaml:

  - name: event.listener
    identifier: 'my-package/typoscript/evaluate-modifier-function'

The corresponding event listener class could look like this:

use TYPO3\CMS\Core\TypoScript\AST\Event\EvaluateModifierFunctionEvent;

final class MyTypoScriptModifierFunction
    public function __invoke(EvaluateModifierFunctionEvent $event): void
        if ($event->getFunctionName() === 'myModifierFunction') {
            $originalValue = $event->getOriginalValue();
            $functionArgument = $event->getFunctionArgument();
            // Manipulate values and set new value
            $event->setValue($originalValue . ' example ' . $functionArgument);