FlashMessageQueue extends SplQueue implements JsonSerializable
A class which collects and renders flash messages.
Table of Contents
Interfaces
- JsonSerializable
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() : FlashMessageQueue
- 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
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([int $severity = null ]) : mixed
Parameters
- $severity : int = null
-
Optional severity, must be one of \TYPO3\CMS\Core\Messaging\AbstractMessage constants
dequeue()
This method is empty, as it will not move any flash message (e.g. from the session)
public
dequeue() : mixed
Tags
Attributes
- #[ReturnTypeWillChange]
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) : FlashMessageQueue
Parameters
- $message : FlashMessage
-
Instance of \TYPO3\CMS\Core\Messaging\FlashMessage, representing a message
Tags
Attributes
- #[ReturnTypeWillChange]
Return values
FlashMessageQueue —Self to allow chaining
getAllMessages()
Returns all messages from the current PHP session and from the current request.
public
getAllMessages([int $severity = null ]) : array<string|int, FlashMessage>
Parameters
- $severity : int = null
-
Optional severity, must be one of \TYPO3\CMS\Core\Messaging\AbstractMessage constants
Return values
array<string|int, FlashMessage>getAllMessagesAndFlush()
Returns all messages from the current PHP session and from the current request.
public
getAllMessagesAndFlush([int $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 : int = null
-
Optional severity, must be one of \TYPO3\CMS\Core\Messaging\AbstractMessage constants
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.
Return values
AbstractUserAuthentication|nullremoveAllFlashMessagesFromSession()
Removes all flash messages from the session
protected
removeAllFlashMessagesFromSession([int $severity = null ]) : mixed
Parameters
- $severity : int = null
-
Optional severity, must be one of \TYPO3\CMS\Core\Messaging\AbstractMessage constants
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