Feature: #107343 - PSR-14 to manipulate form creation process
See forge#107343
Description
A new PSR-14 event
\TYPO3\
has been introduced. It serves as a direct replacement for the now
removed hook
$GLOBALS.
The new event is dispatched immediately before a new form is created in the backend.
The event provides the following public properties:
$form: The form definition array$form: The form persistence identifier used to store the new formPersistence Identifier
Example
An example event listener could look like:
Example event listener class
<?php
namespace MyVendor\MyExtension\Form\EventListener;
use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Form\Event\BeforeFormIsCreatedEvent;
final class MyEventListener
{
#[AsEventListener('my_extension/before-form-is-created')]
public function __invoke(BeforeFormIsCreatedEvent $event): void
{
$event->form['label'] = 'foo';
}
}
Copied!
Impact
With the new
Before, it is
now possible to modify a form before it is created.