Feature: #101838 - BeforeLoadedUserTsConfigEvent

See forge#101838

Description

The PSR-14 event \TYPO3\CMS\Core\TypoScript\IncludeTree\Event\BeforeLoadedUserTsConfigEvent can be used to add global static user TSconfig before anything else is loaded. This is especially useful, if user TSconfig is generated automatically as a string from a PHP function.

It is important to understand that this config is considered static and thus should not depend on runtime / request.

Example

<?php

namespace Vendor\MyExtension\EventListener;

use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Core\TypoScript\IncludeTree\Event\BeforeLoadedUserTsConfigEvent;

#[AsEventListener(identifier: 'vendor/my-extension/global-usertsconfig')]
final class AddGlobalUserTsConfig
{
    public function __invoke(BeforeLoadedUserTsConfigEvent $event): void
    {
        $event->addTsConfig('global = a global setting');
    }
}
Copied!

Impact

Developers are able to define an event listener which is dispatched before any other user TSconfig is loaded.