Merge "HTMLForm: Use <button> and allow differing label and value"
[lhc/web/wiklou.git] / includes / htmlform / HTMLForm.php
index 05fb44e..8bb1bba 100644 (file)
@@ -526,6 +526,21 @@ class HTMLForm extends ContextSource {
                return false;
        }
 
+       /**
+        * Same as self::show with the difference, that the form will be
+        * added to the output, no matter, if the validation was good or not.
+        * @return bool|Status Whether submission was successful.
+        */
+       function showAlways() {
+               $this->prepareForm();
+
+               $result = $this->tryAuthorizedSubmit();
+
+               $this->displayForm( $result );
+
+               return $result;
+       }
+
        /**
         * Validate all the fields, and call the submission callback
         * function if everything is kosher.
@@ -1207,6 +1222,8 @@ class HTMLForm extends ContextSource {
         */
        public function setSubmitDestructive() {
                $this->mSubmitFlags = array( 'destructive', 'primary' );
+
+               return $this;
        }
 
        /**
@@ -1215,6 +1232,8 @@ class HTMLForm extends ContextSource {
         */
        public function setSubmitProgressive() {
                $this->mSubmitFlags = array( 'progressive', 'primary' );
+
+               return $this;
        }
 
        /**
@@ -1451,6 +1470,7 @@ class HTMLForm extends ContextSource {
                $hasLabel = false;
 
                // Conveniently, PHP method names are case-insensitive.
+               // For grep: this can call getDiv, getRaw, getInline, getVForm, getOOUI
                $getFieldHtmlMethod = $displayFormat == 'table' ? 'getTableRow' : ( 'get' . $displayFormat );
 
                foreach ( $fields as $key => $value ) {