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

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

declare(strict_types=1);

namespace MyVendor\MyExtension\Extbase\EventListener;

use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Extbase\Event\Configuration\BeforeFlexFormConfigurationOverrideEvent;

#[AsEventListener(
    identifier: 'my-extension/before-flexform-configuration-override',
)]
final readonly 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!

New in version 13.0

The PHP attribute \TYPO3\CMS\Core\Attribute\AsEventListener has been introduced to tag a PHP class as an event listener. Alternatively, or if you need to be compatible with older TYPO3 versions, you can also register an event listener via the Configuration/Services.yaml file. Switch to an older version of this page for an example or have a look at the section Implementing an event listener in your extension.

API

class \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 ( )
returntype

array

getOriginalFlexFormConfiguration ( )
returntype

array

getFlexFormConfiguration ( )
returntype

array

setFlexFormConfiguration ( array $flexFormConfiguration)
param array $flexFormConfiguration

the flexFormConfiguration