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
$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

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 = '' ][, 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
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<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
todo:

Change $severity to allow ContextualFeedbackSeverity only in v13

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

Search results