'namespaceselect' => 'HTMLSelectNamespace',
'namespaceselectwithbutton' => 'HTMLSelectNamespaceWithButton',
'tagfilter' => 'HTMLTagFilter',
+ 'sizefilter' => 'HTMLSizeFilterField',
'submit' => 'HTMLSubmitField',
'hidden' => 'HTMLHiddenField',
'edittools' => 'HTMLEditTools',
*/
public function trySubmit() {
$valid = true;
- $hoistedErrors = [];
- $hoistedErrors[] = isset( $this->mValidationErrorMessage )
- ? $this->mValidationErrorMessage
- : [ 'htmlform-invalid-input' ];
+ $hoistedErrors = Status::newGood();
+ if ( $this->mValidationErrorMessage ) {
+ foreach ( (array)$this->mValidationErrorMessage as $error ) {
+ call_user_func_array( [ $hoistedErrors, 'fatal' ], $error );
+ }
+ } else {
+ $hoistedErrors->fatal( 'htmlform-invalid-input' );
+ }
$this->mWasSubmitted = true;
if ( $res !== true ) {
$valid = false;
if ( $res !== false && !$field->canDisplayErrors() ) {
- $hoistedErrors[] = [ 'rawmessage', $res ];
+ if ( is_string( $res ) ) {
+ $hoistedErrors->fatal( 'rawmessage', $res );
+ } else {
+ $hoistedErrors->fatal( $res );
+ }
}
}
}
if ( !$valid ) {
- if ( count( $hoistedErrors ) === 1 ) {
- $hoistedErrors = $hoistedErrors[0];
- }
return $hoistedErrors;
}