Feature: #96975 - New PSR-14 events for SiteConfiguration Handling

See forge#96975

Description

Two new events have been added to TYPO3, to allow manipulation of the loaded SiteConfiguration before it is cached and before the configuration is written to disk.

  • \TYPO3\CMS\Core\Configuration\Event\SiteConfigurationBeforeWriteEvent

  • \TYPO3\CMS\Core\Configuration\Event\SiteConfigurationLoadedEvent

Impact

The events SiteConfigurationLoadedEvent and SiteConfigurationBeforeWriteEvent have been introduced.

Both contain the following methods:

  • getSiteIdentifier(): returns the sites' identifier

  • getConfiguration(): returns the configuration (loaded or to be written)

  • setConfiguration(array $configuration): allows overwriting of the configuration

They allow modification of the site configuration array both before loading and before writing the configuration to disk.

To register an event listener for the new events, use the following code in your Services.yaml:

services:
  MyCompany\MyPackage\EventListener\SiteConfigurationLoadedListener:
    tags:
      - name: event.listener
        identifier: 'myLoadedListener'
  MyCompany\MyPackage\EventListener\SiteConfigurationBeforeWriteListener:
    tags:
      - name: event.listener
        identifier: 'myWriteListener'