$s = wfMessage( $longContext, "* $s\n" )->plain();
}
} else {
- $s = '* '. implode( "\n* ",
+ $s = '* ' . implode( "\n* ",
$this->getErrorMessageArray( $this->errors ) ) . "\n";
if ( $longContext ) {
$s = wfMessage( $longContext, $s )->plain();
*/
protected function getErrorMessage( $error ) {
if ( is_array( $error ) ) {
- if( isset( $error['message'] ) && $error['message'] instanceof Message ) {
+ if ( isset( $error['message'] ) && $error['message'] instanceof Message ) {
$msg = $error['message'];
} elseif ( isset( $error['message'] ) && isset( $error['params'] ) ) {
$msg = wfMessage( $error['message'],
*
* @note: this does not perform a full wikitext to HTML conversion, it merely applies
* a message transformation.
- * @todo: figure out whether that is actually The Right Thing.
+ * @todo figure out whether that is actually The Right Thing.
*/
public function getHTML( $shortContext = false, $longContext = false ) {
$text = $this->getWikiText( $shortContext, $longContext );
/**
* Get the list of errors (but not warnings)
*
- * @return Array
+ * @return array A list in which each entry is an array with a message key as its first element.
+ * The remaining array elements are the message parameters.
*/
function getErrorsArray() {
return $this->getStatusArray( "error" );
/**
* Get the list of warnings (but not errors)
*
- * @return Array
+ * @return array A list in which each entry is an array with a message key as its first element.
+ * The remaining array elements are the message parameters.
*/
function getWarningsArray() {
return $this->getStatusArray( "warning" );
$result = array();
foreach ( $this->errors as $error ) {
if ( $error['type'] === $type ) {
- if( $error['message'] instanceof Message ) {
- $result[] = $error['message'];
- } elseif( $error['params'] ) {
+ if ( $error['message'] instanceof Message ) {
+ $result[] = array_merge( array( $error['message']->getKey() ), $error['message']->getParams() );
+ } elseif ( $error['params'] ) {
$result[] = array_merge( array( $error['message'] ), $error['params'] );
} else {
$result[] = array( $error['message'] );