TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
FlashMessageQueue Class Reference
Inheritance diagram for FlashMessageQueue:

Public Member Functions

 __construct ($identifier)
 
 getIdentifier ()
 
 enqueue ($message)
 
 addMessage (FlashMessage $message)
 
 dequeue ()
 
 getAllMessages ($severity=null)
 
 getAllMessagesAndFlush ($severity=null)
 
 renderFlashMessages ()
 
 toArray ()
 
 clear ($severity=null)
 

Protected Member Functions

 addFlashMessageToSession (FlashMessage $message)
 
 storeFlashMessagesInSession (array $flashMessages=null)
 
 removeAllFlashMessagesFromSession ($severity=null)
 
 getFlashMessagesFromSession ()
 
 getUserByContext ()
 

Protected Attributes

 $identifier
 

Detailed Description

A class which collects and renders flash messages.

Definition at line 22 of file FlashMessageQueue.php.

Constructor & Destructor Documentation

__construct (   $identifier)
Parameters
string$identifierThe unique identifier for this queue

Definition at line 34 of file FlashMessageQueue.php.

References FlashMessageQueue\$identifier.

Member Function Documentation

addFlashMessageToSession ( FlashMessage  $message)
protected

Adds the given flash message to the array of flash messages that will be stored in the session.

Parameters
FlashMessage$message
Returns
void

Definition at line 94 of file FlashMessageQueue.php.

References FlashMessageQueue\getFlashMessagesFromSession(), and FlashMessageQueue\storeFlashMessagesInSession().

Referenced by FlashMessageQueue\enqueue().

addMessage ( FlashMessage  $message)
Parameters
FlashMessage$message
Returns
void

Definition at line 74 of file FlashMessageQueue.php.

References FlashMessageQueue\enqueue().

clear (   $severity = null)

Removes all items from the queue

Parameters
int$severityOptional severity, must be one of constants
Returns
void

Definition at line 238 of file FlashMessageQueue.php.

Referenced by FlashMessageQueue\getAllMessagesAndFlush().

dequeue ( )
Returns
void

Definition at line 82 of file FlashMessageQueue.php.

enqueue (   $message)

Adds a message either to the BE_USER session (if the $message has the storeInSession flag set) or it enqueues the message.

Parameters
FlashMessage$messageInstance of , representing a message
Exceptions
TYPO3
Returns
void

Definition at line 55 of file FlashMessageQueue.php.

References FlashMessageQueue\addFlashMessageToSession().

Referenced by FlashMessageQueue\addMessage().

getAllMessages (   $severity = null)

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

Parameters
int$severityOptional severity, must be one of constants
Returns
FlashMessage[]

Definition at line 107 of file FlashMessageQueue.php.

References FlashMessageQueue\getFlashMessagesFromSession(), and FlashMessageQueue\toArray().

Referenced by FlashMessageQueue\getAllMessagesAndFlush().

getAllMessagesAndFlush (   $severity = null)

Returns all messages from the current PHP session and from the current request. After fetching the messages the internal queue and the message queue in the session will be emptied.

Parameters
int$severityOptional severity, must be one of constants
Returns
FlashMessage[]

Definition at line 133 of file FlashMessageQueue.php.

References FlashMessageQueue\clear(), FlashMessageQueue\getAllMessages(), and FlashMessageQueue\removeAllFlashMessagesFromSession().

Referenced by FlashMessageQueue\renderFlashMessages().

getFlashMessagesFromSession ( )
protected

Returns current flash messages from the session, making sure to always return an array.

Returns
FlashMessage[]

Definition at line 181 of file FlashMessageQueue.php.

References FlashMessageQueue\getUserByContext().

Referenced by FlashMessageQueue\addFlashMessageToSession(), FlashMessageQueue\getAllMessages(), and FlashMessageQueue\removeAllFlashMessagesFromSession().

getIdentifier ( )
Returns
string

Definition at line 42 of file FlashMessageQueue.php.

References FlashMessageQueue\$identifier.

getUserByContext ( )
protected

Gets user object by context

Returns
AbstractUserAuthentication

Definition at line 192 of file FlashMessageQueue.php.

References $GLOBALS.

Referenced by FlashMessageQueue\getFlashMessagesFromSession(), and FlashMessageQueue\storeFlashMessagesInSession().

removeAllFlashMessagesFromSession (   $severity = null)
protected

Removes all flash messages from the session

Parameters
int$severityOptional severity, must be one of constants
Returns
void

Definition at line 160 of file FlashMessageQueue.php.

References FlashMessageQueue\getFlashMessagesFromSession(), and FlashMessageQueue\storeFlashMessagesInSession().

Referenced by FlashMessageQueue\getAllMessagesAndFlush().

renderFlashMessages ( )

Fetches and renders all available flash messages from the queue.

Returns
string All flash messages in the queue rendered as HTML.

Definition at line 202 of file FlashMessageQueue.php.

References FlashMessageQueue\getAllMessagesAndFlush().

storeFlashMessagesInSession ( array  $flashMessages = null)
protected

Stores given flash messages in the session

Parameters
FlashMessage[]$flashMessages
Returns
void

Definition at line 149 of file FlashMessageQueue.php.

References FlashMessageQueue\getUserByContext().

Referenced by FlashMessageQueue\addFlashMessageToSession(), and FlashMessageQueue\removeAllFlashMessagesFromSession().

toArray ( )

Returns all items of the queue as array

Returns
FlashMessage[]

Definition at line 221 of file FlashMessageQueue.php.

Referenced by FlashMessageQueue\getAllMessages().

Member Data Documentation

$identifier
protected