Feature: #107380 - PSR-14 to manipulate form duplication process
See forge#107380
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 form is duplicated in the backend.
The event provides the following public properties:
$form: The form definition array$form: The form persistence identifier used to store the duplicated formPersistence Identifier
Example
An example event listener could look like this:
Example event listener class
namespace MyVendor\MyExtension\Form\EventListener;
use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Form\Event\BeforeFormIsDuplicatedEvent;
final class BeforeFormIsDuplicatedEventListener
{
#[AsEventListener('my_extension/before-form-is-duplicated')]
public function __invoke(BeforeFormIsDuplicatedEvent $event): void
{
$event->form['label'] = 'foo';
}
}
Copied!
Impact
With the new
Before, it
is now possible to modify a form before it is duplicated.