MediaWiki master
|
Formatter for StatusValue objects. More...
Public Member Functions | |
__construct (MessageLocalizer $messageLocalizer, MessageCache $messageCache, LoggerInterface $logger) | |
getHTML (StatusValue $status, array $options=[]) | |
Get the error message as HTML. | |
getMessage (StatusValue $status, array $options=[]) | |
Get a bullet list of the errors as a Message object. | |
getPsr3MessageAndContext (StatusValue $status) | |
Try to convert the status to a PSR-3 friendly format. | |
getWikiText (StatusValue $status, array $options=[]) | |
Get the error list as a wikitext formatted list. | |
Formatter for StatusValue objects.
Definition at line 44 of file StatusFormatter.php.
MediaWiki\Status\StatusFormatter::__construct | ( | MessageLocalizer | $messageLocalizer, |
MessageCache | $messageCache, | ||
LoggerInterface | $logger ) |
Definition at line 50 of file StatusFormatter.php.
MediaWiki\Status\StatusFormatter::getHTML | ( | StatusValue | $status, |
array | $options = [] ) |
Get the error message as HTML.
This is done by parsing the wikitext error message
All message parameters that were provided as strings will be escaped with wfEscapeWikiText. This is mostly a historical accident and often undesirable (T368821).
$status->fatal()
, instead of separate key and params parameters.$status->getMessages()
method instead, and display each message separately (or combine then with Message::listParams()
).StatusValue | $status | |
array | $options | An array of options, supporting the following keys:
|
Definition at line 349 of file StatusFormatter.php.
References MediaWiki\Parser\ParserOutput\getText().
MediaWiki\Status\StatusFormatter::getMessage | ( | StatusValue | $status, |
array | $options = [] ) |
Get a bullet list of the errors as a Message object.
All message parameters that were provided as strings will be escaped with wfEscapeWikiText. This is mostly a historical accident and often undesirable (T368821).
$status->fatal()
, instead of separate key and params parameters.$status->getMessages()
method instead, and display each message separately (or combine then with Message::listParams()
).$shortContext and $longContext can be used to wrap the error list in some text. $shortContext will be preferred when there is a single error; $longContext will be preferred when there are multiple ones. In either case, $1 will be replaced with the list of errors.
$shortContext is assumed to use $1 as an inline parameter: if there is a single item, it will not be made into a list; if there are multiple items, newlines will be inserted around the list. $longContext is assumed to use $1 as a standalone parameter; it will always receive a list.
If both parameters are missing, and there is only one error, no bullet will be added.
StatusValue | $status | |
array | $options | An array of options, supporting the following keys:
|
Definition at line 176 of file StatusFormatter.php.
References StatusValue\fatal(), StatusValue\getErrors(), and StatusValue\isOK().
MediaWiki\Status\StatusFormatter::getPsr3MessageAndContext | ( | StatusValue | $status | ) |
Try to convert the status to a PSR-3 friendly format.
The output will be similar to getWikiText( false, false, 'en' ), but message parameters will be extracted into the context array with parameter names 'parameter1' etc. when possible.
Definition at line 234 of file StatusFormatter.php.
References $params, and MediaWiki\Status\StatusFormatter\getWikiText().
MediaWiki\Status\StatusFormatter::getWikiText | ( | StatusValue | $status, |
array | $options = [] ) |
Get the error list as a wikitext formatted list.
All message parameters that were provided as strings will be escaped with wfEscapeWikiText. This is mostly a historical accident and often undesirable (T368821).
$status->fatal()
, instead of separate key and params parameters.$status->getMessages()
method instead, and display each message separately (or combine then with Message::listParams()
).StatusValue | $status | |
array | $options | An array of options, supporting the following keys:
|
Definition at line 99 of file StatusFormatter.php.
References StatusValue\fatal(), StatusValue\getErrors(), and StatusValue\isOK().
Referenced by MediaWiki\Status\StatusFormatter\getPsr3MessageAndContext().