FlashMessage finisher 

The "FlashMessage finisher" is a basic finisher that adds a message to the FlashMessageContainer.

FlashMessage finisher options 

The following options can be set (in the form definition YAML or programmatically):

messageBody

messageBody
Type
string
Required

true

The flash message. May contain placeholders like %s that are replaced with messageArguments.

messageTitle

messageTitle
Type
string
Default
''

If set, is the flash message title.

messageArguments

messageArguments
Type
array
Default
[]

If messageBody contains placeholders (like %s), they will be replaced by these.

messageCode

messageCode
Type
?int
Default
null

A unique code to identify the message. By convention, the unix time stamp at the time when the message is created is used, for example 1758455932.

severity

severity
Type
\TYPO3\CMS\Core\Type\ContextualFeedbackSeverity
Default
ContextualFeedbackSeverity::OK

The severity influences the display (color and icon) of the flash message.

translation.propertiesExcludedFromTranslation

translation.propertiesExcludedFromTranslation
Type
array
Default
[]

Defines a list of finisher option properties to be excluded from translation.

If set, these properties will not be processed by the TranslationService during translation of finisher options. This prevents their values from being replaced by translated equivalents, even if translations exist for those options.

This option is usually generated automatically as soon as FlexForm overrides are in place and normally does not need to be set manually in the form definition.

See Skip translation of overridden form finisher options for an example.

FlashMessage finisher in a YAML form definition 

public/fileadmin/forms/my_form.yaml
identifier: example-form
label: 'example'
type: Form

finishers:
  -
    identifier: FlashMessage
    options:
      messageTitle: 'Merci'
      messageCode: 201905041245
      messageBody: 'Thx for using %s'
      messageArguments:
        - 'TYPO3'
      severity: 0
Copied!

Using FlashMessage finishers in PHP code 

Developers can use the finisher key FlashMessage to create flash message finishers in their own classes:

<?php

use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
use TYPO3\CMS\Form\Domain\Model\FormDefinition;

class SomeClass
{
    private function addFlashMessageFinisher(FormDefinition $formDefinition, string $message)
    {
        $formDefinition->createFinisher('FlashMessage', [
            'messageTitle' => 'Merci',
            'messageCode' => 201905041245,
            'messageBody' => 'Thx for using %s',
            'messageArguments' => ['TYPO3'],
            'severity' => ContextualFeedbackSeverity::OK,
        ]);
    }
}
Copied!

This finisher is implemented in \TYPO3\CMS\Form\Domain\Finishers\FlashMessageFinisher .