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

clear()

Removes all items from the queue

public clear([value-of|ContextualFeedbackSeverity|null $severity = null ]) : mixed

Parameters

$severity : value-of|ContextualFeedbackSeverity|null = null

the int values are deprecated

Tags

todo:

Change $severity to allow ContextualFeedbackSeverity|null only in v13

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([value-of|ContextualFeedbackSeverity|null $severity = null ]) : FlashMessage[]

After fetching the messages the internal queue and the message queue in the session will be emptied.

Parameters

$severity : value-of|ContextualFeedbackSeverity|null = null

the int values are deprecated

Tags

todo:

Change $severity to allow ContextualFeedbackSeverity|null only in v13

Return values

FlashMessage[]

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[]

removeAllFlashMessagesFromSession()

Removes all flash messages from the session

protected removeAllFlashMessagesFromSession([value-of|ContextualFeedbackSeverity|null $severity = null ]) : mixed

Parameters

$severity : value-of|ContextualFeedbackSeverity|null = null

the int values are deprecated

Tags

todo:

Change $severity to allow ContextualFeedbackSeverity|null only in v13

storeFlashMessagesInSession()

Stores given flash messages in the session

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

Parameters

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