47 $this->
id =
$config[
'id'] ??
null;
50 $this->rows =
$config[
'rows'] ?? [];
51 $this->columns =
$config[
'columns'] ?? [];
52 $this->tooltips =
$config[
'tooltips'] ?? [];
56 $this->forcedOn =
$config[
'forcedOn'] ?? [];
57 $this->forcedOff =
$config[
'forcedOff'] ?? [];
60 $table = new \OOUI\Tag(
'table' );
61 $tr = new \OOUI\Tag(
'tr' );
63 $tr->appendContent( $this->
getCellTag(
"\u{00A0}" ) );
64 foreach ( $this->columns
as $columnLabel => $columnTag ) {
66 $this->
getCellTag(
new \OOUI\HtmlSnippet( $columnLabel ) )
69 $table->appendContent( $tr );
72 foreach ( $this->rows
as $rowLabel => $rowTag ) {
73 $table->appendContent(
79 $this->addClasses( [
'mw-widget-checkMatrixWidget' ] );
80 $this->appendContent( $table );
92 $row = new \OOUI\Tag(
'tr' );
94 $labelFieldConfig = $tooltip ? [
'help' => $tooltip ] : [];
96 $labelField = new \OOUI\FieldLayout(
99 'label' =>
new \OOUI\HtmlSnippet( $label ),
101 ] + $labelFieldConfig
103 $row->appendContent( $this->
getCellTag( $labelField ) );
106 foreach ( $this->columns
as $columnTag ) {
107 $thisTag =
"$columnTag-$tag";
110 $checkbox = new \OOUI\CheckboxInputWidget( [
112 'name' => $this->
name ?
"{$this->name}[]" :
null,
113 'id' => $this->
id ?
"{$this->id}-$thisTag" :
null,
118 $row->appendContent( $this->
getCellTag( $checkbox ) );
130 $cell = new \OOUI\Tag(
'td' );
144 return in_array( $tagName, (
array)$this->
values,
true ) ||
146 in_array( $tagName, (
array)$this->forcedOn,
true );
159 $this->isDisabled() ||
161 in_array( $tagName, (
array)$this->forcedOn,
true ) ||
162 in_array( $tagName, (
array)$this->forcedOff,
true )
173 return $this->tooltips[ $label ] ??
null;
177 return 'mw.widgets.CheckMatrixWidget';
191 return parent::getConfig(
$config );