X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fwidget%2FCheckMatrixWidget.php;h=06d8095ed454f7922753de806dc7602d01b0d4df;hb=43a0144346da4e6edbbadee0b7d9def53357bc10;hp=8038c548afb3ce75e7c5aefa5797dc9ee7890ca8;hpb=2311183aa0e041c2fd9c6b50f319d8defe236554;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/widget/CheckMatrixWidget.php b/includes/widget/CheckMatrixWidget.php index 8038c548af..06d8095ed4 100644 --- a/includes/widget/CheckMatrixWidget.php +++ b/includes/widget/CheckMatrixWidget.php @@ -19,8 +19,6 @@ class CheckMatrixWidget extends \OOUI\Widget { protected $forcedOff = []; /** - * CheckMatrixWidget constructor - * * Operates similarly to MultiSelectWidget, but instead of using an array of * options, uses an array of rows and an array of columns to dynamically * construct a matrix of options. The tags used to identify a particular cell @@ -58,19 +56,25 @@ class CheckMatrixWidget extends \OOUI\Widget { // Build the table $table = new \OOUI\Tag( 'table' ); + $table->addClasses( [ 'mw-htmlform-matrix mw-widget-checkMatrixWidget-matrix' ] ); + $thead = new \OOUI\Tag( 'thead' ); + $table->appendContent( $thead ); $tr = new \OOUI\Tag( 'tr' ); + // Build the header $tr->appendContent( $this->getCellTag( "\u{00A0}" ) ); foreach ( $this->columns as $columnLabel => $columnTag ) { $tr->appendContent( - $this->getCellTag( new \OOUI\HtmlSnippet( $columnLabel ) ) + $this->getCellTag( new \OOUI\HtmlSnippet( $columnLabel ), 'th' ) ); } - $table->appendContent( $tr ); + $thead->appendContent( $tr ); // Build the options matrix + $tbody = new \OOUI\Tag( 'tbody' ); + $table->appendContent( $tbody ); foreach ( $this->rows as $rowLabel => $rowTag ) { - $table->appendContent( + $tbody->appendContent( $this->getTableRow( $rowLabel, $rowTag ) ); } @@ -126,8 +130,8 @@ class CheckMatrixWidget extends \OOUI\Widget { * @param mixed $content Content for the cell * @return \OOUI\Tag Resulting cell */ - private function getCellTag( $content ) { - $cell = new \OOUI\Tag( 'td' ); + private function getCellTag( $content, $tagElement = 'td' ) { + $cell = new \OOUI\Tag( $tagElement ); $cell->appendContent( $content ); return $cell; }