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

Public Member Functions

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

Protected Member Functions

 addFlashMessageToSession (FlashMessage $message)
 
 storeFlashMessagesInSession (?array $flashMessages=null)
 
 removeAllFlashMessagesFromSession ($severity=null)
 
FlashMessage[] getFlashMessagesFromSession ()
 
AbstractUserAuthentication null getUserByContext ()
 

Protected Attributes

string $identifier
 

Detailed Description

A class which collects and renders flash messages.

Definition at line 28 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 39 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.

Parameters
FlashMessage$message

Definition at line 103 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 (   $severity = null)

Removes all items from the queue

Parameters
int$severity‪Optional severity, must be one of \TYPO3\CMS\Core\Messaging\AbstractMessage constants

Definition at line 267 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 when PHP >= 8.0 is required and drop #[\ReturnTypeWillChange]

Definition at line 92 of file FlashMessageQueue.php.

◆ enqueue()

FlashMessageQueue 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 62 of file FlashMessageQueue.php.

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

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

◆ getAllMessages()

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

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

Parameters
int$severity‪Optional severity, must be one of \TYPO3\CMS\Core\Messaging\AbstractMessage constants
Returns
FlashMessage[]

Definition at line 116 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 (   $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
int$severity‪Optional severity, must be one of \TYPO3\CMS\Core\Messaging\AbstractMessage constants
Returns
FlashMessage[]

Definition at line 142 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 47 of file FlashMessageQueue.php.

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

◆ getUserByContext()

AbstractUserAuthentication null 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.

Returns
‪AbstractUserAuthentication|null

Definition at line 217 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 294 of file FlashMessageQueue.php.

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

◆ removeAllFlashMessagesFromSession()

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

Removes all flash messages from the session

Parameters
int$severity‪Optional severity, must be one of \TYPO3\CMS\Core\Messaging\AbstractMessage constants

Definition at line 173 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 231 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 251 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