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, array $context=[]) | |
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 45 of file StatusFormatter.php.
MediaWiki\Status\StatusFormatter::__construct | ( | MessageLocalizer | $messageLocalizer, |
MessageCache | $messageCache, | ||
LoggerInterface | $logger ) |
Definition at line 51 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 350 of file StatusFormatter.php.
References NS_SPECIAL.
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 177 of file StatusFormatter.php.
References StatusValue\fatal(), StatusValue\getErrors(), and StatusValue\isOK().
MediaWiki\Status\StatusFormatter::getPsr3MessageAndContext | ( | StatusValue | $status, |
array | $context = [] ) |
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. A predefined context array may be passed for convenience.
Definition at line 236 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 100 of file StatusFormatter.php.
References StatusValue\fatal(), StatusValue\getErrors(), and StatusValue\isOK().
Referenced by MediaWiki\Status\StatusFormatter\getPsr3MessageAndContext().