FlashMessage extends AbstractMessage

A class representing flash messages.

Table of Contents

Constants

ERROR  = 2
INFO  = -1
NOTICE  = -2
OK  = 0
WARNING  = 1

Properties

$message  : string
The message
$severity  : int
The message's severity
$storeInSession  : bool
Defines whether the message should be stored in the session (to survive redirects) or only for one request (default)
$title  : string
The message's title

Methods

__construct()  : mixed
Constructor for a flash message
__toString()  : string
Creates a string representation of the message. Useful for command line use.
createFromArray()  : static
Factory method. Useful when creating flash messages from a jsonSerialize json_decode() call.
getMessage()  : string
Gets the message.
getSeverity()  : int
Gets the message' severity.
getTitle()  : string
Gets the message's title.
isSessionMessage()  : bool
Gets the message's storeInSession flag.
jsonSerialize()  : array<string|int, mixed>
setMessage()  : mixed
Sets the message
setSeverity()  : mixed
Sets the message' severity
setStoreInSession()  : mixed
Sets the message's storeInSession flag
setTitle()  : mixed
Sets the message's title

Constants

Properties

$message

The message

protected string $message = ''

$severity

The message's severity

protected int $severity = self::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

The message's title

protected string $title = ''

Methods

__construct()

Constructor for a flash message

public __construct(string $message[, string $title = '' ][, int $severity = self::OK ][, bool $storeInSession = false ]) : mixed
Parameters
$message : string

The message.

$title : string = ''

Optional message title.

$severity : int = self::OK

Optional severity, must be either of one of \TYPO3\CMS\Core\Messaging\FlashMessage constants

$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) : static
Parameters
$data : array<string, string|int|bool>
Return values
static

getMessage()

Gets the message.

public getMessage() : string
Return values
string

The message.

getSeverity()

Gets the message' severity.

public getSeverity() : int
Return values
int

The message' severity, must be one of AbstractMessage::INFO or similar constants

getTitle()

Gets the message's title.

public getTitle() : string
Return values
string

The message's title.

isSessionMessage()

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()

Sets the message

public setMessage(string $message) : mixed
Parameters
$message : string

The message

setSeverity()

Sets the message' severity

public setSeverity([int $severity = self::OK ]) : mixed
Parameters
$severity : int = self::OK

The severity, must be one of AbstractMessage::INFO or similar constants

setStoreInSession()

Sets the message's storeInSession flag

public setStoreInSession(bool $storeInSession) : mixed
Parameters
$storeInSession : bool

The persistence flag

setTitle()

Sets the message's title

public setTitle(string $title) : mixed
Parameters
$title : string

The message's title


        
On this page

Search results