Merge "specials: Simplify return logic of various SpecialUserlogin methods"
[lhc/web/wiklou.git] / includes / htmlform / HTMLCheckMatrix.php
index 83f1266..7ccb60e 100644 (file)
@@ -85,7 +85,13 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable {
                $rows = $this->mParams['rows'];
                $columns = $this->mParams['columns'];
 
-               $attribs = $this->getAttributes( array( 'disabled', 'tabindex' ) );
+               $mappings = array();
+
+               if ( $this->mParent instanceof OOUIHTMLForm ) {
+                       $mappings['tabindex'] = 'tabIndex';
+               }
+
+               $attribs = $this->getAttributes( array( 'disabled', 'tabindex' ), $mappings );
 
                // Build the column headers
                $headerContents = Html::rawElement( 'td', array(), ' ' );
@@ -126,7 +132,8 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable {
                                        $checked = true;
                                        $thisAttribs['disabled'] = 1;
                                }
-                               $chkBox = Xml::check( "{$this->mName}[]", $checked, $attribs + $thisAttribs );
+                               $chkBox = $this->getOneCheckbox( $checked, $attribs + $thisAttribs );
+
                                if ( $this->mParent->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) {
                                        $chkBox = Html::openElement( 'div', array( 'class' => 'mw-ui-checkbox' ) ) .
                                                $chkBox .
@@ -150,6 +157,18 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable {
                return $html;
        }
 
+       protected function getOneCheckbox( $checked, $attribs ) {
+               if ( $this->mParent instanceof OOUIHTMLForm ) {
+                       return new OOUI\CheckboxInputWidget( array(
+                               'name' => "{$this->mName}[]",
+                               'selected' => $checked,
+                               'value' => '1',
+                       ) + $attribs );
+               }
+
+               return Xml::check( "{$this->mName}[]", $checked, $attribs );
+       }
+
        protected function isTagForcedOff( $tag ) {
                return isset( $this->mParams['force-options-off'] )
                        && in_array( $tag, $this->mParams['force-options-off'] );