- protected function getOneCheckbox( $checked, $attribs ) {
- if ( $this->mParent instanceof OOUIHTMLForm ) {
- return new OOUI\CheckboxInputWidget( [
- 'name' => "{$this->mName}[]",
- 'selected' => $checked,
- ] + OOUI\Element::configFromHtmlAttributes(
- $attribs
- ) );
- } else {
- $checkbox = Xml::check( "{$this->mName}[]", $checked, $attribs );
- if ( $this->mParent->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) {
- $checkbox = Html::openElement( 'div', [ 'class' => 'mw-ui-checkbox' ] ) .
- $checkbox .
- Html::element( 'label', [ 'for' => $attribs['id'] ] ) .
- Html::closeElement( 'div' );
- }
- return $checkbox;
+ public function getInputOOUI( $value ) {
+ $attribs = $this->getAttributes( [ 'disabled', 'tabindex' ] );
+
+ return new MediaWiki\Widget\CheckMatrixWidget(
+ [
+ 'name' => $this->mName,
+ 'infusable' => true,
+ 'id' => $this->mID,
+ 'rows' => $this->mParams['rows'],
+ 'columns' => $this->mParams['columns'],
+ 'tooltips' => $this->mParams['tooltips'] ?? [],
+ 'forcedOff' => $this->mParams['force-options-off'] ?? [],
+ 'forcedOn' => $this->mParams['force-options-on'] ?? [],
+ 'values' => $value,
+ ] + OOUI\Element::configFromHtmlAttributes( $attribs )
+ );
+ }
+
+ protected function getOneCheckboxHTML( $checked, $attribs ) {
+ $checkbox = Xml::check( "{$this->mName}[]", $checked, $attribs );
+ if ( $this->mParent->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) {
+ $checkbox = Html::openElement( 'div', [ 'class' => 'mw-ui-checkbox' ] ) .
+ $checkbox .
+ Html::element( 'label', [ 'for' => $attribs['id'] ] ) .
+ Html::closeElement( 'div' );