Documentation

Mage_Core_Model_Message_Abstract
in package

AbstractYes

Table of Contents

Properties

$_class  : mixed
$_code  : mixed
$_identifier  : mixed
$_isSticky  : mixed
$_method  : mixed
$_textArgs  : array<int, string|Link|null>|null
$_type  : mixed

Methods

__construct()  : mixed
Mage_Core_Model_Message_Abstract constructor.
formatText()  : string
Replace each %s placeholder in $text with one argument. $renderArg converts each argument to a string first. All renderers use this method, so the plain text and the HTML get the same values. If $text does not match the arguments, this method calls $onError and returns $text unchanged. A bad message does not stop the page.
getCode()  : string
getIdentifier()  : mixed
Get message identifier
getIsSticky()  : bool
Get whether message is sticky
getText()  : string
Get the plain text of the message. Each %s placeholder is replaced with its argument.
getTextArgs()  : array<int, string|Link|null>|null
getType()  : string
setClass()  : $this
setCode()  : Mage_Core_Model_Message_Abstract
Set code
setIdentifier()  : Mage_Core_Model_Message_Abstract
Set message identifier
setIsSticky()  : Mage_Core_Model_Message_Abstract
Set message sticky status
setMethod()  : $this
setTextArgs()  : static
Set the values for the %s placeholders in the message text.
toString()  : string

Properties

$_identifier

protected mixed $_identifier

$_isSticky

protected mixed $_isSticky = \false

$_textArgs

protected array<int, string|Link|null>|null $_textArgs = \null

Methods

__construct()

Mage_Core_Model_Message_Abstract constructor.

public __construct(string $type[, string $code = '' ]) : mixed
Parameters
$type : string
$code : string = ''

formatText()

Replace each %s placeholder in $text with one argument. $renderArg converts each argument to a string first. All renderers use this method, so the plain text and the HTML get the same values. If $text does not match the arguments, this method calls $onError and returns $text unchanged. A bad message does not stop the page.

public formatText(string $text, callable(Array): string $renderArg[, callable(Throwable): mixed|null $onError = null ]) : string
Parameters
$text : string
$renderArg : callable(Array): string
$onError : callable(Throwable): mixed|null = null
Return values
string

getCode()

public getCode() : string
Return values
string

getIdentifier()

Get message identifier

public getIdentifier() : mixed

@return string

getIsSticky()

Get whether message is sticky

public getIsSticky() : bool
Return values
bool

getText()

Get the plain text of the message. Each %s placeholder is replaced with its argument.

public getText() : string

A \Maho\Message\Link argument is replaced with its label. This text identifies the message.

An HTML renderer must use getCode() and getTextArgs() and escape each part. If the format string is bad, this method returns the raw text and does not report the error.

Return values
string

getTextArgs()

public getTextArgs() : array<int, string|Link|null>|null
Return values
array<int, string|Link|null>|null —

null when the message was not added as plain text

getType()

public getType() : string
Return values
string

setClass()

public setClass(string $class) : $this
Parameters
$class : string
Return values
$this

setMethod()

public setMethod(string $method) : $this
Parameters
$method : string
Return values
$this

setTextArgs()

Set the values for the %s placeholders in the message text.

public setTextArgs(array<int, string|Link|null> $args) : static

The renderer escapes each value. Do not escape a value in the caller. A \Maho\Message\Link value renders as an anchor. A newline in the text renders as a line break.

Parameters
$args : array<int, string|Link|null>
Return values
static

toString()

public toString() : string
Return values
string
On this page

Search results