// being set. This is used by ConfirmEdit to display a captcha
// without any error message cruft.
} else {
- $this->hookError = $status->getWikiText();
+ $this->hookError = $this->formatStatusErrors( $status );
}
// Use the existing $status->value if the hook set it
if ( !$status->value ) {
} elseif ( !$status->isOK() ) {
# ...or the hook could be expecting us to produce an error
// FIXME this sucks, we should just use the Status object throughout
- $this->hookError = $status->getWikiText();
+ $this->hookError = $this->formatStatusErrors( $status );
$status->fatal( 'hookaborted' );
$status->value = self::AS_HOOK_ERROR_EXPECTED;
return false;
return true;
}
+ /**
+ * Wrap status errors in an errorbox for increased visiblity
+ *
+ * @param Status $status
+ * @return string Wikitext
+ */
+ private function formatStatusErrors( Status $status ) {
+ $errmsg = $status->getWikiText(
+ 'edit-error-short',
+ 'edit-error-long',
+ $this->context->getLanguage()
+ );
+ return <<<ERROR
+<div class="errorbox">
+{$errmsg}
+</div>
+<br clear="all" />
+ERROR;
+ }
+
/**
* Return the summary to be used for a new section.
*
"restrictionsfield-badip": "Invalid IP address or range: $1",
"restrictionsfield-label": "Allowed IP ranges:",
"restrictionsfield-help": "One IP address or CIDR range per line. To enable everything, use:<pre>0.0.0.0/0\n::/0</pre>",
+ "edit-error-short": "Error: $1",
+ "edit-error-long": "Errors:\n\n$1",
"revid": "revision $1",
"pageid": "page ID $1",
"rawhtml-notallowed": "<html> tags cannot be used outside of normal pages.",
"restrictionsfield-badip": "An error message shown when one entered an invalid IP address or range in a restrictions field (such as Special:BotPassword). $1 is the IP address.",
"restrictionsfield-label": "Field label shown for restriction fields (e.g. on Special:BotPassword).",
"restrictionsfield-help": "Placeholder text displayed in restriction fields (e.g. on Special:BotPassword).",
+ "edit-error-short": "Error message. Parameters:\n* $1 - the error details\nSee also:\n* {{msg-mw|edit-error-long}}\n{{Identical|Error}}",
+ "edit-error-long": "Error message. Parameters:\n* $1 - the error details\nSee also:\n* {{msg-mw|edit-error-short}}\n{{Identical|Error}}",
"revid": "Used to format a revision ID number in text. Parameters:\n* $1 - Revision ID number.\n{{Identical|Revision}}",
"pageid": "Used to format a page ID number in text. Parameters:\n* $1 - Page ID number.",
"rawhtml-notallowed": "Error message given when $wgRawHtml = true; is set and a user uses an <html> tag in a system message or somewhere other than a normal page.",