@@ -39,8 +39,8 @@ A more elaborate example:
3939 );
4040
4141
42- The messages are then displayed by Fluid with the relevant Viewhelper
43- as shown in this excerpt of :file: ` EXT:examples/Resources/Private/Layouts/Module.html ` :
42+ The messages are then displayed by Fluid with the
43+ ` FlashMessages ViewHelper <f:flashMessages> < https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-flashmessages >`_ :
4444
4545.. code-block :: html
4646
@@ -53,3 +53,49 @@ as shown in this excerpt of :file:`EXT:examples/Resources/Private/Layouts/Module
5353
5454Where to display the flash messages in an Extbase-based backend module is
5555as simple as moving the ViewHelper around.
56+
57+ By default, all messages are put into the scope of the
58+ current plugin namespace with a prefix `extbase.flashmessages. `. So
59+ if your plugin namespace is computed as `tx_myvendor_myplugin `, the
60+ flash message queue identifier will be
61+ `extbase.flashmessages.tx_myvendor_myplugin `.
62+
63+ .. _flash-messages-extbase-distinct :
64+
65+ Using explicit flash message queues in Extbase
66+ ==============================================
67+
68+ It is possible to add a message to a different flash message queue. Use
69+ cases could be a detailed display of different flash message queues in
70+ different places of the page or displaying a flash message when you
71+ forward to a different controller or even a different extension.
72+
73+ If you need distinct queues, you can use a custom identifier to fetch
74+ and operate on that queue:
75+
76+ .. code-block :: php
77+
78+ $customQueue = $this->getFlashMessageQueue('tx_myvendor_customqueue');
79+ // Instead of using $this->addFlashMessage() you will instead directly
80+ // access the custom queue:
81+ $flashMessage = GeneralUtility::makeInstance(
82+ FlashMessage::class,
83+ 'My flash message in a custom queue',
84+ 'My flash message title of a custom queue',
85+ ContextualFeedbackSeverity::OK,
86+ $storeInSession = true,
87+ );
88+ $customQueue->enqueue($flashMessage);
89+
90+ .. _flash-messages-extbase-fluid-queueidentifier :
91+
92+ Fluid flash messages ViewHelper with explicit queue identifier
93+ ==============================================================
94+
95+ When you used an :ref: `explicit flash message queue <flash-messages-extbase-distinct >`
96+ during enqueueing the message, it will only be displayed on the page if you use the
97+ same identifier in the `FlashMessages ViewHelper <f:flashMessages> <https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-flashmessages >`_.
98+
99+ .. code-block :: html
100+
101+ <f:flashMessages queueIdentifier =" tx_myvendor_customqueue" />
0 commit comments