FlashMessageQueue extends SplQueue implements JsonSerializable
A class which collects and renders flash messages.
Table of Contents
Interfaces
- JsonSerializable
Constants
- FLASHMESSAGE_QUEUE = 'core.template.flashMessages'
- NOTIFICATION_QUEUE = 'core.template.notifications'
Properties
- $identifier : string
- A unique identifier for this queue
Methods
- __construct() : mixed
- addMessage() : mixed
- clear() : mixed
- Removes all items from the queue
- dequeue() : mixed
- This method is empty, as it will not move any flash message (e.g. from the session)
- enqueue() : void
- Adds a message either to the BE_USER session (if the $message has the storeInSession flag set) or it enqueues the message.
- getAllMessages() : array<string|int, FlashMessage>
- Returns all messages from the current PHP session and from the current request.
- getAllMessagesAndFlush() : array<string|int, FlashMessage>
- Returns all messages from the current PHP session and from the current request.
- getIdentifier() : string
- jsonSerialize() : array<string|int, mixed>
- renderFlashMessages() : string
- Fetches and renders all available flash messages from the queue.
- toArray() : array<string|int, FlashMessage>
- Returns all items of the queue as array
- addFlashMessageToSession() : mixed
- Adds the given flash message to the array of flash messages that will be stored in the session.
- getFlashMessagesFromSession() : array<string|int, FlashMessage>
- Returns current flash messages from the session, making sure to always return an array.
- getUserByContext() : AbstractUserAuthentication|null
- Gets user object by context.
- removeAllFlashMessagesFromSession() : mixed
- Removes all flash messages from the session
- storeFlashMessagesInSession() : mixed
- Stores given flash messages in the session
Constants
FLASHMESSAGE_QUEUE
public
mixed
FLASHMESSAGE_QUEUE
= 'core.template.flashMessages'
NOTIFICATION_QUEUE
public
mixed
NOTIFICATION_QUEUE
= 'core.template.notifications'
Properties
$identifier
A unique identifier for this queue
protected
string
$identifier
Methods
__construct()
public
__construct(string $identifier) : mixed
Parameters
- $identifier : string
-
The unique identifier for this queue
addMessage()
public
addMessage(FlashMessage $message) : mixed
Parameters
- $message : FlashMessage
clear()
Removes all items from the queue
public
clear([ContextualFeedbackSeverity|null $severity = null ]) : mixed
Parameters
- $severity : ContextualFeedbackSeverity|null = null
dequeue()
This method is empty, as it will not move any flash message (e.g. from the session)
public
dequeue() : mixed
Tags
enqueue()
Adds a message either to the BE_USER session (if the $message has the storeInSession flag set) or it enqueues the message.
public
enqueue(FlashMessage $message) : void
Parameters
- $message : FlashMessage
-
Instance of \TYPO3\CMS\Core\Messaging\FlashMessage, representing a message
Tags
getAllMessages()
Returns all messages from the current PHP session and from the current request.
public
getAllMessages([ContextualFeedbackSeverity|null $severity = null ]) : array<string|int, FlashMessage>
Parameters
- $severity : ContextualFeedbackSeverity|null = null
Return values
array<string|int, FlashMessage>getAllMessagesAndFlush()
Returns all messages from the current PHP session and from the current request.
public
getAllMessagesAndFlush([ContextualFeedbackSeverity|null $severity = null ]) : array<string|int, FlashMessage>
After fetching the messages the internal queue and the message queue in the session will be emptied.
Parameters
- $severity : ContextualFeedbackSeverity|null = null
Return values
array<string|int, FlashMessage>getIdentifier()
public
getIdentifier() : string
Return values
stringjsonSerialize()
public
jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —Data which can be serialized by json_encode()
renderFlashMessages()
Fetches and renders all available flash messages from the queue.
public
renderFlashMessages([FlashMessageRendererInterface|null $flashMessageRenderer = null ]) : string
Parameters
- $flashMessageRenderer : FlashMessageRendererInterface|null = null
Return values
string —All flash messages in the queue rendered by context based FlashMessageRendererResolver.
toArray()
Returns all items of the queue as array
public
toArray() : array<string|int, FlashMessage>
Return values
array<string|int, FlashMessage>addFlashMessageToSession()
Adds the given flash message to the array of flash messages that will be stored in the session.
protected
addFlashMessageToSession(FlashMessage $message) : mixed
Parameters
- $message : FlashMessage
getFlashMessagesFromSession()
Returns current flash messages from the session, making sure to always return an array.
protected
getFlashMessagesFromSession() : array<string|int, FlashMessage>
Return values
array<string|int, FlashMessage>getUserByContext()
Gets user object by context.
protected
getUserByContext() : AbstractUserAuthentication|null
This class is also used in install tool, where $GLOBALS['BE_USER'] is not set and can be null.
Tags
Return values
AbstractUserAuthentication|nullremoveAllFlashMessagesFromSession()
Removes all flash messages from the session
protected
removeAllFlashMessagesFromSession([ContextualFeedbackSeverity|null $severity = null ]) : mixed
Parameters
- $severity : ContextualFeedbackSeverity|null = null
storeFlashMessagesInSession()
Stores given flash messages in the session
protected
storeFlashMessagesInSession([array<string|int, FlashMessage>|null $flashMessages = null ]) : mixed
Parameters
- $flashMessages : array<string|int, FlashMessage>|null = null