‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Messaging\FlashMessage Class Reference
Inheritance diagram for TYPO3\CMS\Core\Messaging\FlashMessage:
TYPO3\CMS\Core\Messaging\AbstractMessage

Public Member Functions

 __construct ($message, $title='', ContextualFeedbackSeverity $severity=ContextualFeedbackSeverity::OK, $storeInSession=false)
 
bool isSessionMessage ()
 
 setStoreInSession ($storeInSession)
 
array jsonSerialize ()
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Core\Messaging\AbstractMessage
 getTitle ()
 
 setTitle (string $title)
 
 getMessage ()
 
 setMessage (string $message)
 
 getSeverity ()
 
 setSeverity (ContextualFeedbackSeverity $severity=ContextualFeedbackSeverity::OK)
 
string __toString ()
 

Static Public Member Functions

static static createFromArray (array $data)
 

Protected Attributes

bool $storeInSession = false
 
- ‪Protected Attributes inherited from ‪TYPO3\CMS\Core\Messaging\AbstractMessage
string $title = ''
 
string $message = ''
 
ContextualFeedbackSeverity $severity = ContextualFeedbackSeverity::OK
 

Detailed Description

A class representing flash messages.

Definition at line 26 of file FlashMessage.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Messaging\FlashMessage::__construct (   $message,
  $title = '',
ContextualFeedbackSeverity  $severity = ContextualFeedbackSeverity::OK,
  $storeInSession = false 
)

Constructor for a flash message

Parameters
string$message‪The message.
string$title‪Optional message title.
ContextualFeedbackSeverity$severity
bool$storeInSession‪Optional, defines whether the message should be stored in the session or only for one request (default)

Definition at line 42 of file FlashMessage.php.

References TYPO3\CMS\Core\Messaging\AbstractMessage\$message, TYPO3\CMS\Core\Messaging\AbstractMessage\$severity, TYPO3\CMS\Core\Messaging\AbstractMessage\$title, TYPO3\CMS\Core\Messaging\AbstractMessage\setMessage(), TYPO3\CMS\Core\Messaging\AbstractMessage\setSeverity(), TYPO3\CMS\Core\Messaging\FlashMessage\setStoreInSession(), and TYPO3\CMS\Core\Messaging\AbstractMessage\setTitle().

Member Function Documentation

◆ createFromArray()

static static TYPO3\CMS\Core\Messaging\FlashMessage::createFromArray ( array  $data)
static

Factory method. Useful when creating flash messages from a jsonSerialize json_decode() call.

Parameters
array<string,string|int|bool>‪$data
Returns
‪static

Definition at line 56 of file FlashMessage.php.

Referenced by TYPO3\CMS\Core\Messaging\FlashMessageQueue\getFlashMessagesFromSession().

◆ isSessionMessage()

bool TYPO3\CMS\Core\Messaging\FlashMessage::isSessionMessage ( )

Gets the message's storeInSession flag.

Returns
‪bool TRUE if message should be stored in the session, otherwise FALSE.

Definition at line 72 of file FlashMessage.php.

References TYPO3\CMS\Core\Messaging\FlashMessage\$storeInSession.

◆ jsonSerialize()

array TYPO3\CMS\Core\Messaging\FlashMessage::jsonSerialize ( )
Returns
‪array Data which can be serialized by json_encode()

Reimplemented from TYPO3\CMS\Core\Messaging\AbstractMessage.

Definition at line 90 of file FlashMessage.php.

References TYPO3\CMS\Core\Messaging\FlashMessage\$storeInSession.

◆ setStoreInSession()

TYPO3\CMS\Core\Messaging\FlashMessage::setStoreInSession (   $storeInSession)

Sets the message's storeInSession flag

Parameters
bool$storeInSession‪The persistence flag

Definition at line 82 of file FlashMessage.php.

References TYPO3\CMS\Core\Messaging\FlashMessage\$storeInSession.

Referenced by TYPO3\CMS\Core\Messaging\FlashMessage\__construct().

Member Data Documentation

◆ $storeInSession

bool TYPO3\CMS\Core\Messaging\FlashMessage::$storeInSession = false
protected

Defines whether the message should be stored in the session (to survive redirects) or only for one request (default)

Definition at line 32 of file FlashMessage.php.

Referenced by TYPO3\CMS\Core\Messaging\FlashMessage\isSessionMessage(), TYPO3\CMS\Core\Messaging\FlashMessage\jsonSerialize(), and TYPO3\CMS\Core\Messaging\FlashMessage\setStoreInSession().