PHP Класс Contao\Message

The class handles system messages which are shown to the user. You can add messages from anywhere in the application. Usage: Message::addError('Please enter your name'); Message::addConfirm('The data has been stored'); Message::addInfo('You can upload only two files'); Message::addNew('There are two new messages');
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
add ( string $strMessage, string $strType, string $strScope = TL_MODE ) Add a message
addConfirmation ( string $strMessage, string $strScope = TL_MODE ) Add a confirmation message
addError ( string $strMessage, string $strScope = TL_MODE ) Add an error message
addInfo ( string $strMessage, string $strScope = TL_MODE ) Add an info message
addNew ( string $strMessage, string $strScope = TL_MODE ) Add a new message
addRaw ( string $strMessage, string $strScope = TL_MODE ) Add a preformatted message
generate ( string $strScope = TL_MODE ) : string Return the messages with a wrapping container as HTML
generateUnwrapped ( string $strScope = TL_MODE ) : string Return the messages as HTML
getTypes ( ) : array Return all available message types
hasConfirmation ( string $strScope = TL_MODE ) : boolean Check if there are confirmation messages
hasError ( string $strScope = TL_MODE ) : boolean Check if there are error messages
hasInfo ( string $strScope = TL_MODE ) : boolean Check if there are info messages
hasMessages ( string $strScope = TL_MODE ) : boolean Check if there are any messages
hasNew ( string $strScope = TL_MODE ) : boolean Check if there are new messages
hasRaw ( string $strScope = TL_MODE ) : boolean Check if there are raw messages
reset ( ) Reset the message system

Защищенные методы

Метод Описание
getFlashBagKey ( string $strType, string | null $strScope = TL_MODE ) : string Return the flash bag key

Описание методов

add() публичный статический метод

Add a message
public static add ( string $strMessage, string $strType, string $strScope = TL_MODE )
$strMessage string The message text
$strType string The message type
$strScope string An optional message scope

addConfirmation() публичный статический метод

Add a confirmation message
public static addConfirmation ( string $strMessage, string $strScope = TL_MODE )
$strMessage string The confirmation message
$strScope string An optional message scope

addError() публичный статический метод

Add an error message
public static addError ( string $strMessage, string $strScope = TL_MODE )
$strMessage string The error message
$strScope string An optional message scope

addInfo() публичный статический метод

Add an info message
public static addInfo ( string $strMessage, string $strScope = TL_MODE )
$strMessage string The info message
$strScope string An optional message scope

addNew() публичный статический метод

Add a new message
public static addNew ( string $strMessage, string $strScope = TL_MODE )
$strMessage string The new message
$strScope string An optional message scope

addRaw() публичный статический метод

Add a preformatted message
public static addRaw ( string $strMessage, string $strScope = TL_MODE )
$strMessage string The preformatted message
$strScope string An optional message scope

generate() публичный статический метод

Return the messages with a wrapping container as HTML
public static generate ( string $strScope = TL_MODE ) : string
$strScope string An optional message scope
Результат string The messages HTML markup

generateUnwrapped() публичный статический метод

Return the messages as HTML
public static generateUnwrapped ( string $strScope = TL_MODE ) : string
$strScope string An optional message scope
Результат string The messages HTML markup

getFlashBagKey() защищенный статический метод

Return the flash bag key
protected static getFlashBagKey ( string $strType, string | null $strScope = TL_MODE ) : string
$strType string The message type
$strScope string | null The message scope
Результат string The flash bag key

getTypes() публичный статический метод

Return all available message types
public static getTypes ( ) : array
Результат array An array of message types

hasConfirmation() публичный статический метод

Check if there are confirmation messages
public static hasConfirmation ( string $strScope = TL_MODE ) : boolean
$strScope string An optional message scope
Результат boolean True if there are confirmation messages

hasError() публичный статический метод

Check if there are error messages
public static hasError ( string $strScope = TL_MODE ) : boolean
$strScope string An optional message scope
Результат boolean True if there are error messages

hasInfo() публичный статический метод

Check if there are info messages
public static hasInfo ( string $strScope = TL_MODE ) : boolean
$strScope string An optional message scope
Результат boolean True if there are info messages

hasMessages() публичный статический метод

Check if there are any messages
public static hasMessages ( string $strScope = TL_MODE ) : boolean
$strScope string An optional message scope
Результат boolean True if there are messages

hasNew() публичный статический метод

Check if there are new messages
public static hasNew ( string $strScope = TL_MODE ) : boolean
$strScope string An optional message scope
Результат boolean True if there are new messages

hasRaw() публичный статический метод

Check if there are raw messages
public static hasRaw ( string $strScope = TL_MODE ) : boolean
$strScope string An optional message scope
Результат boolean True if there are raw messages

reset() публичный статический метод

Reset the message system
public static reset ( )