From a6651f3d641536c3dc7a84034cbd9837748630e4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Fr=C3=B6mken?= <noreply@example.com>
Date: Tue, 30 Apr 2019 10:11:44 +0200
Subject: [PATCH] [TASK] Better example for FlashMessage finisher
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- Show how to use messageArguments
- messageCode is mandatory (Don't know why, but yes it is)
--> As it is mandatory, it does not make sense to write `if needed`
- remove `Default value` from mandatory options
--> As all calls in TYPO3 Core are strict types, a value like `null`
will throw an Exception

Releases: master
Resolves: #88247
Change-Id: Ibf101a7c35ae01c975dbcaf162ff38f4eef27221
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60631
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Jörg Bösche <typo3@joergboesche.de>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Jörg Bösche <typo3@joergboesche.de>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
---
 .../Documentation/I/ApiReference/Index.rst    | 23 ++++++++++---------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/typo3/sysext/form/Documentation/I/ApiReference/Index.rst b/typo3/sysext/form/Documentation/I/ApiReference/Index.rst
index c7a6d80098c4..3cce68cd48ab 100644
--- a/typo3/sysext/form/Documentation/I/ApiReference/Index.rst
+++ b/typo3/sysext/form/Documentation/I/ApiReference/Index.rst
@@ -2213,8 +2213,11 @@ Usage within form definition
      -
        identifier: FlashMessage
        options:
-         messageBody: 'Thx for using TYPO3'
          messageTitle: 'Merci'
+         messageCode: 201905041245
+         messageBody: 'Thx for using %s'
+         messageArguments:
+           - 'TYPO3'
          severity: 0
    ...
 
@@ -2222,8 +2225,10 @@ Usage within form definition
 Usage through code::
 
    $formDefinition->createFinisher('FlashMessage', [
-       'messageBody' => 'Thx for using TYPO3',
        'messageTitle' => 'Merci',
+       'messageCode' => 201905041245,
+       'messageBody' => 'Thx for using %s',
+       'messageArguments' => ['TYPO3'],
        'severity' => \TYPO3\CMS\Core\Messaging\AbstractMessage::OK,
    ]);
 
@@ -2231,8 +2236,10 @@ or create manually (not preferred)::
 
    $flashMessageFinisher = $this->objectManager->get(FlashMessageFinisher::class);
    $flashMessageFinisher->setOptions([
-       'messageBody' => 'Thx for using TYPO3',
        'messageTitle' => 'Merci',
+       'messageCode' => 201905041245,
+       'messageBody' => 'Thx for using %s',
+       'messageArguments' => ['TYPO3'],
        'severity' => \TYPO3\CMS\Core\Messaging\AbstractMessage::OK,
    ]);
    $formDefinition->addFinisher($flashMessageFinisher);
@@ -2254,9 +2261,6 @@ messageBody
 :aspect:`Mandatory`
       Yes
 
-:aspect:`Default value`
-      null
-
 :aspect:`Description`
       The flash message body
 
@@ -2276,7 +2280,7 @@ messageTitle
       empty string
 
 :aspect:`Description`
-      The flash message title
+      The flash message title, if needed
 
 
 .. _apireference-finisheroptions-flashmessagefinisher-options-messagearguments:
@@ -2308,11 +2312,8 @@ messageCode
 :aspect:`Mandatory`
       Yes
 
-:aspect:`Default value`
-      null
-
 :aspect:`Description`
-      The flash message code, if needed
+      The flash message code
 
 
 .. _apireference-finisheroptions-flashmessagefinisher-options-severity:
-- 
GitLab