Merge "Fix Button label in OOUI HTML Form and enable flags"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 27 Jun 2015 13:20:50 +0000 (13:20 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 27 Jun 2015 13:20:50 +0000 (13:20 +0000)
includes/htmlform/HTMLButtonField.php
includes/htmlform/HTMLSubmitField.php

index 9f30ee3..afd7cf6 100644 (file)
 class HTMLButtonField extends HTMLFormField {
        protected $buttonType = 'button';
 
+       /** @var array $mFlags Flags to add to OOUI Button widget */
+       protected $mFlags = array();
+
        public function __construct( $info ) {
                $info['nodata'] = true;
+               if ( isset( $info['flags'] ) )
+                       $this->mFlags = $info['flags'];
                parent::__construct( $info );
        }
 
@@ -33,9 +38,11 @@ class HTMLButtonField extends HTMLFormField {
                return new OOUI\ButtonInputWidget( array(
                        'name' => $this->mName,
                        'value' => $value,
+                       'label' => $value,
                        'type' => $this->buttonType,
                        'classes' => array( 'mw-htmlform-submit', $this->mClass ),
                        'id' => $this->mID,
+                       'flags' => $this->mFlags,
                ) + $this->getAttributes( array( 'disabled', 'tabindex' ), array( 'tabindex' => 'tabIndex' ) ) );
        }
 
index 653c08c..938e428 100644 (file)
@@ -6,4 +6,6 @@
  */
 class HTMLSubmitField extends HTMLButtonField {
        protected $buttonType = 'submit';
+
+       protected $mFlags = array( 'primary', 'constructive' );
 }