FlashMessage extends AbstractMessage
A class representing flash messages.
Table of Contents
Constants
Properties
- $message : string
- $severity : ContextualFeedbackSeverity
- $storeInSession : bool
- Defines whether the message should be stored in the session (to survive redirects) or only for one request (default)
- $title : string
Methods
- __construct() : mixed
- Constructor for a flash message
- __toString() : string
- Creates a string representation of the message. Useful for command line use.
- createFromArray() : self
- Factory method. Useful when creating flash messages from a jsonSerialize json_decode() call.
- getMessage() : string
- getSeverity() : ContextualFeedbackSeverity
- getTitle() : string
- isSessionMessage() : bool
- Gets the message's storeInSession flag.
- jsonSerialize() : array<string|int, mixed>
- setMessage() : void
- setSeverity() : void
- Sets the message' severity
- setStoreInSession() : mixed
- Sets the message's storeInSession flag
- setTitle() : void
Constants
ERROR
Use \TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::ERROR instead
public
mixed
ERROR
= 2
INFO
Use \TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::INFO instead
public
mixed
INFO
= -1
NOTICE
Use \TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::NOTICE instead
public
mixed
NOTICE
= -2
OK
Use \TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::OK instead
public
mixed
OK
= 0
WARNING
Use \TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::WARNING instead
public
mixed
WARNING
= 1
Properties
$message
protected
string
$message
= ''
$severity
protected
ContextualFeedbackSeverity
$severity
= \TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::OK
$storeInSession
Defines whether the message should be stored in the session (to survive redirects) or only for one request (default)
protected
bool
$storeInSession
= false
$title
protected
string
$title
= ''
Methods
__construct()
Constructor for a flash message
public
__construct(string $message[, string $title = '' ][, mixed $severity = ContextualFeedbackSeverity::OK ][, bool $storeInSession = false ]) : mixed
Parameters
- $message : string
-
The message.
- $title : string = ''
-
Optional message title.
- $severity : mixed = ContextualFeedbackSeverity::OK
- $storeInSession : bool = false
-
Optional, defines whether the message should be stored in the session or only for one request (default)
__toString()
Creates a string representation of the message. Useful for command line use.
public
__toString() : string
Return values
string —A string representation of the message.
createFromArray()
Factory method. Useful when creating flash messages from a jsonSerialize json_decode() call.
public
static createFromArray(array<string, string|int|bool> $data) : self
Parameters
- $data : array<string, string|int|bool>
Return values
selfgetMessage()
public
getMessage() : string
Return values
stringgetSeverity()
public
getSeverity() : ContextualFeedbackSeverity
Return values
ContextualFeedbackSeveritygetTitle()
public
getTitle() : string
Return values
stringisSessionMessage()
Gets the message's storeInSession flag.
public
isSessionMessage() : bool
Return values
bool —TRUE if message should be stored in the session, otherwise FALSE.
jsonSerialize()
public
jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —Data which can be serialized by json_encode()
setMessage()
public
setMessage(string $message) : void
Parameters
- $message : string
setSeverity()
Sets the message' severity
public
setSeverity([int|ContextualFeedbackSeverity $severity = ContextualFeedbackSeverity::OK ]) : void
Parameters
- $severity : int|ContextualFeedbackSeverity = ContextualFeedbackSeverity::OK
Tags
setStoreInSession()
Sets the message's storeInSession flag
public
setStoreInSession(bool $storeInSession) : mixed
Parameters
- $storeInSession : bool
-
The persistence flag
setTitle()
public
setTitle(string $title) : void
Parameters
- $title : string