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

dequeue()

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

public dequeue() : mixed
Tags
todo:

Set return type to mixed in v13

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) : void
Parameters
$message : FlashMessage

Instance of \TYPO3\CMS\Core\Messaging\FlashMessage, representing a message

Tags
throws
Exception

getAllMessagesAndFlush()

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

public getAllMessagesAndFlush([int|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 : int|ContextualFeedbackSeverity|null = null
Tags
todo:

Change $severity to allow ContextualFeedbackSeverity|null only in v13

Return values
array<string|int, FlashMessage>

getIdentifier()

public getIdentifier() : string
Return values
string

jsonSerialize()

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.

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>

removeAllFlashMessagesFromSession()

Removes all flash messages from the session

protected removeAllFlashMessagesFromSession([int|ContextualFeedbackSeverity|null $severity = null ]) : mixed
Parameters
$severity : int|ContextualFeedbackSeverity|null = null
Tags
todo:

Change $severity to allow ContextualFeedbackSeverity|null only in v13

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

        
On this page

Search results