X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fhtmlform%2FHTMLCheckMatrix.php;h=7ccb60e04eaa203e784bbd87d04ea6149ce2507f;hb=1e84ab0bae3af68a70fcd1f81d36f9af4fef9518;hp=83f126657f5ab2c3c536a6a4f5efb117121c81c2;hpb=579d6e75554610c03d1096d61bf1d4b2f680468c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/htmlform/HTMLCheckMatrix.php b/includes/htmlform/HTMLCheckMatrix.php index 83f126657f..7ccb60e04e 100644 --- a/includes/htmlform/HTMLCheckMatrix.php +++ b/includes/htmlform/HTMLCheckMatrix.php @@ -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'] );