‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Messaging\FlashMessageQueue Class Reference
Inheritance diagram for TYPO3\CMS\Core\Messaging\FlashMessageQueue:

Public Member Functions

 __construct ($identifier)
 
string getIdentifier ()
 
 enqueue ($message)
 
 addMessage (FlashMessage $message)
 
 dequeue ()
 
FlashMessage[] getAllMessages (int|ContextualFeedbackSeverity|null $severity=null)
 
FlashMessage[] getAllMessagesAndFlush (int|ContextualFeedbackSeverity|null $severity=null)
 
string renderFlashMessages (FlashMessageRendererInterface $flashMessageRenderer=null)
 
FlashMessage[] toArray ()
 
 clear (int|ContextualFeedbackSeverity|null $severity=null)
 
array jsonSerialize ()
 

Public Attributes

const FLASHMESSAGE_QUEUE = 'core.template.flashMessages'
 
const NOTIFICATION_QUEUE = 'core.template.notifications'
 

Protected Member Functions

 addFlashMessageToSession (FlashMessage $message)
 
 storeFlashMessagesInSession (array $flashMessages=null)
 
 removeAllFlashMessagesFromSession (int|ContextualFeedbackSeverity|null $severity=null)
 
FlashMessage[] getFlashMessagesFromSession ()
 
 getUserByContext ()
 

Protected Attributes

string $identifier
 

Detailed Description

A class which collects and renders flash messages.

Definition at line 29 of file FlashMessageQueue.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Messaging\FlashMessageQueue::__construct (   $identifier)
Parameters
string$identifier‪The unique identifier for this queue

Definition at line 43 of file FlashMessageQueue.php.

References TYPO3\CMS\Core\Messaging\FlashMessageQueue\$identifier.

Member Function Documentation

◆ addFlashMessageToSession()

TYPO3\CMS\Core\Messaging\FlashMessageQueue::addFlashMessageToSession ( FlashMessage  $message)
protected

Adds the given flash message to the array of flash messages that will be stored in the session.

Definition at line 98 of file FlashMessageQueue.php.

References TYPO3\CMS\Core\Messaging\FlashMessageQueue\getFlashMessagesFromSession(), and TYPO3\CMS\Core\Messaging\FlashMessageQueue\storeFlashMessagesInSession().

Referenced by TYPO3\CMS\Core\Messaging\FlashMessageQueue\enqueue().

◆ addMessage()

◆ clear()

TYPO3\CMS\Core\Messaging\FlashMessageQueue::clear ( int|ContextualFeedbackSeverity|null  $severity = null)

Removes all items from the queue

Parameters
value-of<ContextualFeedbackSeverity>|ContextualFeedbackSeverity|null‪$severity the int values are deprecated
Todo:
‪: Change $severity to allow ContextualFeedbackSeverity|null only in v13

Definition at line 280 of file FlashMessageQueue.php.

Referenced by TYPO3\CMS\Core\Messaging\FlashMessageQueue\getAllMessagesAndFlush().

◆ dequeue()

TYPO3\CMS\Core\Messaging\FlashMessageQueue::dequeue ( )

This method is empty, as it will not move any flash message (e.g. from the session)

Todo:
‪: Set return type to mixed in v13

Definition at line 89 of file FlashMessageQueue.php.

◆ enqueue()

TYPO3\CMS\Core\Messaging\FlashMessageQueue::enqueue (   $message)

Adds a message either to the BE_USER session (if the $message has the storeInSession flag set) or it enqueues the message.

Parameters
FlashMessage$message‪Instance of \TYPO3\CMS\Core\Messaging\FlashMessage, representing a message
Exceptions

Definition at line 63 of file FlashMessageQueue.php.

References TYPO3\CMS\Core\Messaging\FlashMessageQueue\addFlashMessageToSession().

Referenced by TYPO3\CMS\Core\Messaging\FlashMessageQueue\addMessage(), and TYPO3\CMS\Core\FormProtection\FormProtectionFactory\getMessageClosure().

◆ getAllMessages()

FlashMessage [] TYPO3\CMS\Core\Messaging\FlashMessageQueue::getAllMessages ( int|ContextualFeedbackSeverity|null  $severity = null)

Returns all messages from the current PHP session and from the current request.

Parameters
value-of<ContextualFeedbackSeverity>|ContextualFeedbackSeverity|null‪$severity the int values are deprecated
Returns
FlashMessage[]
Todo:
‪: Change $severity to allow ContextualFeedbackSeverity|null only in v13

Definition at line 113 of file FlashMessageQueue.php.

References TYPO3\CMS\Core\Messaging\FlashMessageQueue\getFlashMessagesFromSession(), and TYPO3\CMS\Core\Messaging\FlashMessageQueue\toArray().

Referenced by TYPO3\CMS\Install\SystemEnvironment\ServerResponse\ServerResponseCheck\asStatus(), TYPO3\CMS\Install\SystemEnvironment\ServerResponse\ServerResponseCheck\finishMessageQueue(), and TYPO3\CMS\Core\Messaging\FlashMessageQueue\getAllMessagesAndFlush().

◆ getAllMessagesAndFlush()

FlashMessage [] TYPO3\CMS\Core\Messaging\FlashMessageQueue::getAllMessagesAndFlush ( int|ContextualFeedbackSeverity|null  $severity = null)

Returns all messages from the current PHP session and from the current request. After fetching the messages the internal queue and the message queue in the session will be emptied.

Parameters
value-of<ContextualFeedbackSeverity>|ContextualFeedbackSeverity|null‪$severity the int values are deprecated
Returns
FlashMessage[]
Todo:
‪: Change $severity to allow ContextualFeedbackSeverity|null only in v13

Definition at line 145 of file FlashMessageQueue.php.

References TYPO3\CMS\Core\Messaging\FlashMessageQueue\clear(), TYPO3\CMS\Core\Messaging\FlashMessageQueue\getAllMessages(), and TYPO3\CMS\Core\Messaging\FlashMessageQueue\removeAllFlashMessagesFromSession().

Referenced by TYPO3\CMS\Core\Messaging\FlashMessageQueue\renderFlashMessages().

◆ getFlashMessagesFromSession()

FlashMessage [] TYPO3\CMS\Core\Messaging\FlashMessageQueue::getFlashMessagesFromSession ( )
protected

◆ getIdentifier()

string TYPO3\CMS\Core\Messaging\FlashMessageQueue::getIdentifier ( )
Returns
‪string

Definition at line 51 of file FlashMessageQueue.php.

References TYPO3\CMS\Core\Messaging\FlashMessageQueue\$identifier.

◆ getUserByContext()

TYPO3\CMS\Core\Messaging\FlashMessageQueue::getUserByContext ( )
protected

Gets user object by context. This class is also used in install tool, where $GLOBALS['BE_USER'] is not set and can be null.

Definition at line 228 of file FlashMessageQueue.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Core\Messaging\FlashMessageQueue\getFlashMessagesFromSession(), TYPO3\CMS\Core\Messaging\FlashMessageQueue\removeAllFlashMessagesFromSession(), and TYPO3\CMS\Core\Messaging\FlashMessageQueue\storeFlashMessagesInSession().

◆ jsonSerialize()

array TYPO3\CMS\Core\Messaging\FlashMessageQueue::jsonSerialize ( )
Returns
‪array Data which can be serialized by json_encode()

Definition at line 311 of file FlashMessageQueue.php.

References TYPO3\CMS\Core\Messaging\FlashMessageQueue\toArray().

◆ removeAllFlashMessagesFromSession()

TYPO3\CMS\Core\Messaging\FlashMessageQueue::removeAllFlashMessagesFromSession ( int|ContextualFeedbackSeverity|null  $severity = null)
protected

Removes all flash messages from the session

Parameters
value-of<ContextualFeedbackSeverity>|ContextualFeedbackSeverity|null‪$severity the int values are deprecated
Todo:
‪: Change $severity to allow ContextualFeedbackSeverity|null only in v13

Definition at line 182 of file FlashMessageQueue.php.

References TYPO3\CMS\Core\Messaging\FlashMessageQueue\getFlashMessagesFromSession(), TYPO3\CMS\Core\Messaging\FlashMessageQueue\getUserByContext(), and TYPO3\CMS\Core\Messaging\FlashMessageQueue\storeFlashMessagesInSession().

Referenced by TYPO3\CMS\Core\Messaging\FlashMessageQueue\getAllMessagesAndFlush().

◆ renderFlashMessages()

string TYPO3\CMS\Core\Messaging\FlashMessageQueue::renderFlashMessages ( FlashMessageRendererInterface  $flashMessageRenderer = null)

Fetches and renders all available flash messages from the queue.

Parameters
FlashMessageRendererInterface | null$flashMessageRenderer
Returns
‪string All flash messages in the queue rendered by context based FlashMessageRendererResolver.

Definition at line 242 of file FlashMessageQueue.php.

References TYPO3\CMS\Core\Messaging\FlashMessageQueue\getAllMessagesAndFlush().

◆ storeFlashMessagesInSession()

TYPO3\CMS\Core\Messaging\FlashMessageQueue::storeFlashMessagesInSession ( array  $flashMessages = null)
protected

◆ toArray()

FlashMessage [] TYPO3\CMS\Core\Messaging\FlashMessageQueue::toArray ( )

Returns all items of the queue as array

Returns
FlashMessage[]

Definition at line 262 of file FlashMessageQueue.php.

Referenced by TYPO3\CMS\Core\Messaging\FlashMessageQueue\getAllMessages(), and TYPO3\CMS\Core\Messaging\FlashMessageQueue\jsonSerialize().

Member Data Documentation

◆ $identifier

string TYPO3\CMS\Core\Messaging\FlashMessageQueue::$identifier
protected

◆ FLASHMESSAGE_QUEUE

const TYPO3\CMS\Core\Messaging\FlashMessageQueue::FLASHMESSAGE_QUEUE = 'core.template.flashMessages'

Definition at line 31 of file FlashMessageQueue.php.

◆ NOTIFICATION_QUEUE

const TYPO3\CMS\Core\Messaging\FlashMessageQueue::NOTIFICATION_QUEUE = 'core.template.notifications'