FlashMessage extends AbstractMessage
A class representing flash messages.
Table of Contents
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
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 = '' ][, ContextualFeedbackSeverity $severity = ContextualFeedbackSeverity::OK ][, bool $storeInSession = false ]) : mixed
Parameters
- $message : string
-
The message.
- $title : string = ''
-
Optional message title.
- $severity : ContextualFeedbackSeverity = 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([ContextualFeedbackSeverity $severity = ContextualFeedbackSeverity::OK ]) : void
Parameters
- $severity : ContextualFeedbackSeverity = ContextualFeedbackSeverity::OK
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