HTMLFormFieldWithButton: Don't make the button primary by default
authorBartosz Dziewoński <matma.rex@gmail.com>
Thu, 10 Mar 2016 20:17:26 +0000 (21:17 +0100)
committerBartosz Dziewoński <matma.rex@gmail.com>
Thu, 10 Mar 2016 20:22:51 +0000 (21:22 +0100)
It results in multiple 'primary' buttons in forms, contrary to the
guidelines, for example on Special:Export.

Before: https://phabricator.wikimedia.org/F3605116
After: https://phabricator.wikimedia.org/F3605163

Changed Special:BotPasswords to explicitly use a 'primary' button,
since as far as I can tell it only displays a single button.

Change-Id: Ic647d2650ca635644245eb657cce045db9869fc5

includes/htmlform/HTMLFormFieldWithButton.php
includes/specials/SpecialBotPasswords.php

index 272af15..1ebd280 100644 (file)
@@ -19,7 +19,7 @@ class HTMLFormFieldWithButton extends HTMLFormField {
        protected $mButtonValue;
 
        /** @var string $mButtonType Value for the button in this field */
-       protected $mButtonFlags = [ 'primary', 'progressive' ];
+       protected $mButtonFlags = [ 'progressive' ];
 
        public function __construct( $info ) {
                if ( isset( $info['buttonclass'] ) ) {
index 11357fb..abb4e11 100644 (file)
@@ -192,6 +192,7 @@ class SpecialBotPasswords extends FormSpecialPage {
                                'type' => 'textwithbutton',
                                'label-message' => 'botpasswords-label-appid',
                                'buttondefault' => $this->msg( 'botpasswords-label-create' )->text(),
+                               'buttonflags' => [ 'progressive', 'primary' ],
                                'required' => true,
                                'size' => BotPassword::APPID_MAXLENGTH,
                                'maxlength' => BotPassword::APPID_MAXLENGTH,