Correct button colours of preference page when $wgUseMediaWikiUIEverywhere is enabled
[lhc/web/wiklou.git] / includes / htmlform / HTMLForm.php
index 5fda7bd..d582da3 100644 (file)
@@ -139,6 +139,7 @@ class HTMLForm extends ContextSource {
        protected $mFieldTree;
        protected $mShowReset = false;
        protected $mShowSubmit = true;
+       protected $mSubmitModifierClass = 'mw-ui-constructive';
 
        protected $mSubmitCallback;
        protected $mValidationErrorMessage;
@@ -897,7 +898,7 @@ class HTMLForm extends ContextSource {
                        $attribs['class'] = array( 'mw-htmlform-submit' );
 
                        if ( $this->isVForm() || $useMediaWikiUIEverywhere ) {
-                               array_push( $attribs['class'], 'mw-ui-button', 'mw-ui-constructive' );
+                               array_push( $attribs['class'], 'mw-ui-button', $this->mSubmitModifierClass );
                        }
 
                        if ( $this->isVForm() ) {
@@ -1042,6 +1043,14 @@ class HTMLForm extends ContextSource {
                return $this;
        }
 
+       /**
+        * Identify that the submit button in the form has a destructive action
+        *
+        */
+       public function setSubmitDestructive() {
+               $this->mSubmitModifierClass = 'mw-ui-destructive';
+       }
+
        /**
         * Set the text for the submit button to a message
         * @since 1.19