BeforeFinishersAreExecutedEvent 

The event \TYPO3\CMS\Form\Event\BeforeFinishersAreExecutedEvent is dispatched once a form was submitted successfully: after the last page is validated and before the finishers of the form run. A listener can react to the submission, for example to notify an external system.

The finishers of this submission are in $finishers, in the order they run. A listener can remove, reorder, or add finishers. This changes only the current submission, not the form definition. The form runtime is available in $formRuntime, and the finisher context, which every finisher receives, in $finisherContext. Variables that a listener adds to the finisher variable provider of the context are available to the finishers.

Example: Skip the confirmation email when the user declines it 

The form newsletterSignup has a field sendConfirmationEmail. If the user sets it to no, the following listener removes the finisher EmailToSender, which sends the confirmation email. All other finishers still run:

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

declare(strict_types=1);

namespace MyVendor\MyExtension\EventListener;

use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Form\Domain\Finishers\AbstractFinisher;
use TYPO3\CMS\Form\Domain\Finishers\FinisherInterface;
use TYPO3\CMS\Form\Event\BeforeFinishersAreExecutedEvent;

final readonly class SkipConfirmationEmailListener
{
  #[AsEventListener(
    identifier: 'my-extension/skip-confirmation-email',
  )]
  public function __invoke(BeforeFinishersAreExecutedEvent $event): void
  {
    if ($event->formRuntime->getIdentifier() !== 'newsletterSignup') {
      return;
    }
    $formValues = $event->finisherContext->getFormValues();
    if (($formValues['sendConfirmationEmail'] ?? 'yes') !== 'no') {
      return;
    }
    // Remove the email to the sender, keep all other finishers
    $event->finishers = array_values(array_filter(
      $event->finishers,
      static fn(FinisherInterface $finisher): bool =>
        !$finisher instanceof AbstractFinisher
        || $finisher->getFinisherIdentifier() !== 'EmailToSender',
    ));
  }
}
Copied!

API of BeforeFinishersAreExecutedEvent 

final class BeforeFinishersAreExecutedEvent
Fully qualified name
\TYPO3\CMS\Form\Event\BeforeFinishersAreExecutedEvent

Listeners to this event are able to react to a successfully submitted form and to modify the finishers executed for this submission.

public finishers
public readonly formRuntime
public readonly finisherContext