FlashMessageQueue

class \TYPO3\CMS\Core\Messaging\FlashMessageQueue

Extends
SplQueue
Implements
JsonSerializable

A class which collects and renders flash messages.

Table of Contents

Interfaces

JsonSerializable

Constants

FLASHMESSAGE_QUEUE  : mixed = 'core.template.flashMessages'
NOTIFICATION_QUEUE  : mixed = '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()  : FlashMessage[]
Returns all messages from the current PHP session and from the current request.
getAllMessagesAndFlush()  : FlashMessage[]
Returns all messages from the current PHP session and from the current request.
getIdentifier()  : string
jsonSerialize()  : array
renderFlashMessages()  : string
Fetches and renders all available flash messages from the queue.
toArray()  : 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()  : 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

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

getIdentifier()

public getIdentifier() : string

Return values

string

jsonSerialize()

public jsonSerialize() : array

Return values

array —

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() : FlashMessage[]

Return values

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

todo:

This construct needs to be removed. Methods that use this should be changed to get the user hand over explicitly from the caller! A patch should make this global access a b/w compat fallback only and adapt consuming methods accordingly.

Return values

AbstractUserAuthentication|null

storeFlashMessagesInSession()

Stores given flash messages in the session

protected storeFlashMessagesInSession([FlashMessage[]|null $flashMessages = null ]) : mixed

Parameters

$flashMessages : FlashMessage[]|null = null
On this page