FlashMessageFinisher extends AbstractFinisher

A simple finisher that adds a message to the FlashMessageContainer

Usage: //... $flashMessageFinisher = GeneralUtility::makeInstance(FlashMessageFinisher::class); $flashMessageFinisher->setOptions( [ 'messageBody' => 'Some message body', 'messageTitle' => 'Some message title', 'messageArguments' => ['foo' => 'bar'], 'severity' => \TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::ERROR ] ); $formDefinition->addFinisher($flashMessageFinisher); // ...

Scope: frontend

Table of Contents

Properties

$defaultOptions  : array<string|int, mixed>
These are the default options of the finisher.
$finisherContext  : FinisherContext
$finisherIdentifier  : string
$options  : array<string|int, mixed>
The options which have been set from the outside. Instead of directly accessing them, you should rather use parseOption().
$shortFinisherIdentifier  : string

Methods

execute()  : string|null
Executes the finisher
getFinisherIdentifier()  : string
injectExtensionService()  : void
injectFlashMessageService()  : void
isEnabled()  : bool
Returns whether this finisher is enabled
setFinisherIdentifier()  : void
setOption()  : mixed
Sets a single finisher option (@see setOptions())
setOptions()  : mixed
executeInternal()  : string|void|null
Executes this finisher
getTypoScriptFrontendController()  : TypoScriptFrontendController
parseOption()  : string|array<string|int, mixed>|int|null
Read the option called $optionName from $this->options, and parse {...} as object accessors.
resolveRuntimeReference()  : int|string|array<string|int, mixed>
Resolving property by name from submitted form data.
substituteRuntimeReferences()  : mixed
You can encapsulate an option value with {}.
translateFinisherOption()  : array<string|int, mixed>|string
Wraps TranslationService::translateFinisherOption to recursively invoke all array items of resolved form state values or nested finisher option configuration settings.

Properties

$defaultOptions

These are the default options of the finisher.

protected array<string|int, mixed> $defaultOptions = ['messageBody' => null, 'messageTitle' => '', 'messageArguments' => [], 'messageCode' => null, 'severity' => \TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::OK]

$finisherIdentifier

protected string $finisherIdentifier = ''

$options

The options which have been set from the outside. Instead of directly accessing them, you should rather use parseOption().

protected array<string|int, mixed> $options = []

$shortFinisherIdentifier

protected string $shortFinisherIdentifier = ''

Methods

execute()

Executes the finisher

public final execute(FinisherContext $finisherContext) : string|null
Parameters
$finisherContext : FinisherContext

The Finisher context that contains the current Form Runtime and Response

Return values
string|null

getFinisherIdentifier()

public getFinisherIdentifier() : string
Return values
string

isEnabled()

Returns whether this finisher is enabled

public isEnabled() : bool
Return values
bool

setFinisherIdentifier()

public setFinisherIdentifier(string $finisherIdentifier) : void
Parameters
$finisherIdentifier : string

The identifier for this finisher

setOption()

Sets a single finisher option (@see setOptions())

public setOption(string $optionName, mixed $optionValue) : mixed
Parameters
$optionName : string

name of the option to be set

$optionValue : mixed

value of the option

setOptions()

public setOptions(array<string|int, mixed> $options) : mixed
Parameters
$options : array<string|int, mixed>

configuration options in the format ['option1' => 'value1', 'option2' => 'value2', ...]

parseOption()

Read the option called $optionName from $this->options, and parse {...} as object accessors.

protected parseOption(string $optionName) : string|array<string|int, mixed>|int|null

Then translate the value.

If $optionName was not found, the corresponding default option is returned (from $this->defaultOptions)

Parameters
$optionName : string
Return values
string|array<string|int, mixed>|int|null

resolveRuntimeReference()

Resolving property by name from submitted form data.

protected resolveRuntimeReference(string $property, FormRuntime $formRuntime) : int|string|array<string|int, mixed>
Parameters
$property : string
$formRuntime : FormRuntime
Return values
int|string|array<string|int, mixed>

substituteRuntimeReferences()

You can encapsulate an option value with {}.

protected substituteRuntimeReferences(string|array<string|int, mixed> $needle, FormRuntime $formRuntime) : mixed

This enables you to access every gettable property from the TYPO3\CMS\Form\Domain\Runtime\FormRuntime.

For example: {formState.formValues.<elementIdentifier>} or {<elementIdentifier>}

Both examples are equal to "$formRuntime->getFormState()->getFormValues()[<elementIdentifier>]" There is a special option value '{__currentTimestamp}'. This will be replaced with the current timestamp.

Parameters
$needle : string|array<string|int, mixed>
$formRuntime : FormRuntime

translateFinisherOption()

Wraps TranslationService::translateFinisherOption to recursively invoke all array items of resolved form state values or nested finisher option configuration settings.

protected translateFinisherOption(string|array<string|int, mixed> $subject, FormRuntime $formRuntime, string $optionName, string|array<string|int, mixed> $optionValue, array<string|int, mixed> $translationOptions) : array<string|int, mixed>|string
Parameters
$subject : string|array<string|int, mixed>
$formRuntime : FormRuntime
$optionName : string
$optionValue : string|array<string|int, mixed>
$translationOptions : array<string|int, mixed>
Return values
array<string|int, mixed>|string

        
On this page

Search results