FlashMessage

class \TYPO3\CMS\Core\Messaging\FlashMessage

Extends
AbstractMessage

A class representing flash messages.

Table of Contents

Constants

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

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
setMessage()  : void
setSeverity()  : void
Sets the message' severity
setStoreInSession()  : mixed
Sets the message's storeInSession flag
setTitle()  : void

Constants

ERROR

Deprecated

Use \TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::ERROR instead

public mixed ERROR = 2

INFO

Deprecated

Use \TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::INFO instead

public mixed INFO = -1

NOTICE

Deprecated

Use \TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::NOTICE instead

public mixed NOTICE = -2

OK

Deprecated

Use \TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::OK instead

public mixed OK = 0

WARNING

Deprecated

Use \TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::WARNING instead

public mixed WARNING = 1

Properties

$storeInSession

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

protected bool $storeInSession = false

Methods

__construct()

Constructor for a flash message

public __construct(string $message[, string $title = '' ][, int|value-of|ContextualFeedbackSeverity $severity = ContextualFeedbackSeverity::OK ][, bool $storeInSession = false ]) : mixed

Parameters

$message : string

The message.

$title : string = ''

Optional message title.

$severity : int|value-of|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

self

getMessage()

public getMessage() : string

Return values

string

getTitle()

public getTitle() : string

Return values

string

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

Return values

array —

Data which can be serialized by json_encode()

setMessage()

public setMessage(string $message) : void

Parameters

$message : string

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
On this page