BeforeFormIsDeletedEvent 

New in version 14.0

The event BeforeFormIsDeletedEvent is a more powerful replacement for the removed hook $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/form']['beforeFormDelete'] .

The event BeforeFormIsDeletedEvent can prevent the deletion of a form and add custom logic based on the delete action. The event is dispatched just before a form is deleted in the backend.

Setting $preventDeletion to true, stops the event and no further listener is called.

Example 

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

declare(strict_types=1);

namespace MyVendor\MyExtension\EventListener;

use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Form\Event\BeforeFormIsDeletedEvent;

#[AsEventListener(
    identifier: 'my-extension/before-form-is-deleted',
)]
final readonly class MyEventListener
{
    public function __invoke(BeforeFormIsDeletedEvent $event): void
    {
        if ($event->formPersistenceIdentifier === 'some-identifier') {
            $event->preventDeletion = true;
        }
    }
}
Copied!

API 

class BeforeFormIsDeletedEvent
Fully qualified name
\TYPO3\CMS\Form\Event\BeforeFormIsDeletedEvent

Listeners to this Event will be able to: - Get the form persistence identifier before a form is deleted - Stop the deletion process by setting preventDeletion to true - Add custom logic, e.g. cleanup tasks, before deletion

public readonly formPersistenceIdentifier
public preventDeletion
isPropagationStopped ( )
Returns
bool