AfterFormDefinitionValidationConfigurationIsBuiltEvent
New in version 15.0 Feature: #109849 - PSR-14 Event after form definition validation config is built
The event replaces the removed hook
$GLOBALS.
The event
\TYPO3\
is dispatched after the validation configuration of the form editor has
been built for a prototype. The form editor only saves the properties that
this configuration allows. A listener can add property paths for a custom
inspector editor that does not declare its paths in the YAML configuration,
for example with property.
Example: Allow the form editor to save a custom property
The following listener allows the form editor to save the property
properties. of the custom form element
My. A custom inspector editor sets this property without a
property in the YAML configuration:
<?php
declare(strict_types=1);
namespace MyVendor\MyExtension\EventListener;
use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Form\Event\AfterFormDefinitionValidationConfigurationIsBuiltEvent as Event;
final readonly class CustomPropertyPathListener
{
#[AsEventListener(
identifier: 'my-extension/custom-property-path',
)]
public function __invoke(Event $event): void
{
$configuration = $event->getConfiguration();
$element = $configuration['formElements']['MyCustomElement'] ?? [];
// Allow the form editor to write a property that a custom
// inspector editor sets without a "propertyPath"
$element['additionalPropertyPaths'][] = 'properties.my.custom.property';
$configuration['formElements']['MyCustomElement'] = $element;
$event->setConfiguration($configuration);
}
}
API
-
final class
AfterFormDefinitionValidationConfigurationIsBuiltEvent -
- Fully qualified name
-
\TYPO3\CMS\ Form\ Event\ After Form Definition Validation Configuration Is Built Event
Listeners to this event are able to modify the form definition validation configuration after it has been built from the form editor setup. Use this event to add additional writable property paths for custom form editor inspector editor implementations that do not declare their writable property paths through the standard YAML configuration (e.g. propertyPath).