BeforeFlexFormConfigurationOverrideEvent

New in version 12.3

The PSR-14 event \TYPO3\CMS\Extbase\Event\Configuration\BeforeFlexFormConfigurationOverrideEvent can be used to implement a custom FlexForm override process based on the original FlexForm configuration and the framework configuration.

Example

Registration of the event listener in the extension's Services.yaml:

EXT:my_extension/Configuration/Services.yaml
services:
  # Place here the default dependency injection configuration

  MyVendor\MyExtension\Extbase\EventListener\MyEventListener:
    tags:
      - name: event.listener
        identifier: 'my-extension/before-flexform-configuration-override'
Copied!

Read how to configure dependency injection in extensions.

The corresponding event listener class:

EXT:my_extension/Classes/Extbase/EventListener/MyEventListener.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Extbase\EventListener;

use TYPO3\CMS\Extbase\Event\Configuration\BeforeFlexFormConfigurationOverrideEvent;

final class MyEventListener
{
    public function __invoke(BeforeFlexFormConfigurationOverrideEvent $event): void
    {
        // Configuration from TypoScript
        $frameworkConfiguration = $event->getFrameworkConfiguration();

        // Configuration from FlexForm
        $originalFlexFormConfiguration = $event->getOriginalFlexFormConfiguration();

        // Currently merged configuration
        $flexFormConfiguration = $event->getFlexFormConfiguration();

        // Implement custom logic
        $flexFormConfiguration['settings']['foo'] = 'set from event listener';

        $event->setFlexFormConfiguration($flexFormConfiguration);
    }
}
Copied!

API

class BeforeFlexFormConfigurationOverrideEvent
Fully qualified name
\TYPO3\CMS\Extbase\Event\Configuration\BeforeFlexFormConfigurationOverrideEvent

Event which is dispatched before flexForm configuration overrides framework configuration. Possible core flexForm overrides have already been processed in $flexFormConfiguration.

Listeners can implement a custom flexForm override process by using the original flexForm configuration available in $originalFlexFormConfiguration.

getFrameworkConfiguration ( )
Returns
array
getOriginalFlexFormConfiguration ( )
Returns
array
getFlexFormConfiguration ( )
Returns
array
setFlexFormConfiguration ( array $flexFormConfiguration)
param $flexFormConfiguration

the flexFormConfiguration