Merge "Add CollationFa"
[lhc/web/wiklou.git] / includes / htmlform / HTMLForm.php
index 1f4d99e..71ccaa3 100644 (file)
@@ -147,6 +147,7 @@ class HTMLForm extends ContextSource {
                'namespaceselect' => 'HTMLSelectNamespace',
                'namespaceselectwithbutton' => 'HTMLSelectNamespaceWithButton',
                'tagfilter' => 'HTMLTagFilter',
+               'sizefilter' => 'HTMLSizeFilterField',
                'submit' => 'HTMLSubmitField',
                'hidden' => 'HTMLHiddenField',
                'edittools' => 'HTMLEditTools',
@@ -603,10 +604,14 @@ class HTMLForm extends ContextSource {
         */
        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;
 
@@ -633,15 +638,16 @@ class HTMLForm extends ContextSource {
                        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;
                }