MediaWiki  master
MediaWiki\Widget\CheckMatrixWidget Class Reference

Check matrix widget. More...

Inheritance diagram for MediaWiki\Widget\CheckMatrixWidget:
Collaboration diagram for MediaWiki\Widget\CheckMatrixWidget:

Public Member Functions

 __construct (array $config=[])
 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. More...
 
 getConfig (&$config)
 

Protected Member Functions

 getJavaScriptClassName ()
 

Protected Attributes

array $columns
 
array $forcedOff
 
array $forcedOn
 
string null $id
 
string null $name
 
array $rows
 
array $tooltips
 
array $values
 

Private Member Functions

 getCellTag ( $content, $tagElement='td')
 Get an individual cell tag with requested content. More...
 
 getTableRow ( $label, $tag)
 Get a formatted table row for the option, with a checkbox widget. More...
 
 getTooltip ( $label)
 Get the tooltip help associated with this row. More...
 
 isTagChecked ( $tagName)
 Check whether the given tag's checkbox should be checked. More...
 
 isTagDisabled ( $tagName)
 Check whether the given tag's checkbox should be disabled. More...
 

Detailed Description

Check matrix widget.

Displays a matrix of checkboxes for given options

Note
2018 MediaWiki Widgets Team and others; see AUTHORS.txt
MIT

Definition at line 11 of file CheckMatrixWidget.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Widget\CheckMatrixWidget::__construct ( array  $config = [])

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 are of the form "columnName-rowName"

Parameters
array$configConfiguration array with the following options:
  • columns
    • Required associative array mapping column labels (as HTML) to their tags.
  • rows
    • Required associative array mapping row labels (as HTML) to their tags.
  • force-options-on
    • Array of column-row tags to be displayed as enabled but unavailable to change.
  • force-options-off
    • Array of column-row tags to be displayed as disabled but unavailable to change.
  • tooltips
    • Optional associative array mapping row labels to tooltips (as text, will be escaped).

Definition at line 47 of file CheckMatrixWidget.php.

References MediaWiki\$config, MediaWiki\Widget\CheckMatrixWidget\getCellTag(), and MediaWiki\Widget\CheckMatrixWidget\getTableRow().

Member Function Documentation

◆ getCellTag()

MediaWiki\Widget\CheckMatrixWidget::getCellTag (   $content,
  $tagElement = 'td' 
)
private

Get an individual cell tag with requested content.

Parameters
mixed$contentContent for the

cell

Parameters
string$tagElement
Returns
\OOUI\Tag Resulting cell

Definition at line 142 of file CheckMatrixWidget.php.

References $content.

Referenced by MediaWiki\Widget\CheckMatrixWidget\__construct(), and MediaWiki\Widget\CheckMatrixWidget\getTableRow().

◆ getConfig()

◆ getJavaScriptClassName()

MediaWiki\Widget\CheckMatrixWidget::getJavaScriptClassName ( )
protected

Definition at line 189 of file CheckMatrixWidget.php.

◆ getTableRow()

MediaWiki\Widget\CheckMatrixWidget::getTableRow (   $label,
  $tag 
)
private

Get a formatted table row for the option, with a checkbox widget.

Parameters
string$labelRow label (as HTML)
string$tagRow tag name
Returns
\OOUI\Tag The resulting table row

Definition at line 103 of file CheckMatrixWidget.php.

References MediaWiki\Widget\CheckMatrixWidget\getCellTag(), MediaWiki\Widget\CheckMatrixWidget\getTooltip(), MediaWiki\Widget\CheckMatrixWidget\isTagChecked(), and MediaWiki\Widget\CheckMatrixWidget\isTagDisabled().

Referenced by MediaWiki\Widget\CheckMatrixWidget\__construct().

◆ getTooltip()

MediaWiki\Widget\CheckMatrixWidget::getTooltip (   $label)
private

Get the tooltip help associated with this row.

Parameters
string$labelLabel name
Returns
string Tooltip. Null if none is available.

Definition at line 185 of file CheckMatrixWidget.php.

Referenced by MediaWiki\Widget\CheckMatrixWidget\getTableRow().

◆ isTagChecked()

MediaWiki\Widget\CheckMatrixWidget::isTagChecked (   $tagName)
private

Check whether the given tag's checkbox should be checked.

Parameters
string$tagNameTag name
Returns
bool Tag should be checked

Definition at line 155 of file CheckMatrixWidget.php.

Referenced by MediaWiki\Widget\CheckMatrixWidget\getTableRow().

◆ isTagDisabled()

MediaWiki\Widget\CheckMatrixWidget::isTagDisabled (   $tagName)
private

Check whether the given tag's checkbox should be disabled.

Parameters
string$tagNameTag name
Returns
bool Tag should be disabled

Definition at line 169 of file CheckMatrixWidget.php.

Referenced by MediaWiki\Widget\CheckMatrixWidget\getTableRow().

Member Data Documentation

◆ $columns

array MediaWiki\Widget\CheckMatrixWidget::$columns
protected

Definition at line 17 of file CheckMatrixWidget.php.

Referenced by MediaWiki\Widget\CheckMatrixWidget\getConfig().

◆ $forcedOff

array MediaWiki\Widget\CheckMatrixWidget::$forcedOff
protected

Definition at line 27 of file CheckMatrixWidget.php.

Referenced by MediaWiki\Widget\CheckMatrixWidget\getConfig().

◆ $forcedOn

array MediaWiki\Widget\CheckMatrixWidget::$forcedOn
protected

Definition at line 25 of file CheckMatrixWidget.php.

Referenced by MediaWiki\Widget\CheckMatrixWidget\getConfig().

◆ $id

string null MediaWiki\Widget\CheckMatrixWidget::$id
protected

Definition at line 15 of file CheckMatrixWidget.php.

Referenced by MediaWiki\Widget\CheckMatrixWidget\getConfig().

◆ $name

string null MediaWiki\Widget\CheckMatrixWidget::$name
protected

Definition at line 13 of file CheckMatrixWidget.php.

Referenced by MediaWiki\Widget\CheckMatrixWidget\getConfig().

◆ $rows

array MediaWiki\Widget\CheckMatrixWidget::$rows
protected

Definition at line 19 of file CheckMatrixWidget.php.

Referenced by MediaWiki\Widget\CheckMatrixWidget\getConfig().

◆ $tooltips

array MediaWiki\Widget\CheckMatrixWidget::$tooltips
protected

Definition at line 21 of file CheckMatrixWidget.php.

Referenced by MediaWiki\Widget\CheckMatrixWidget\getConfig().

◆ $values

array MediaWiki\Widget\CheckMatrixWidget::$values
protected

Definition at line 23 of file CheckMatrixWidget.php.

Referenced by MediaWiki\Widget\CheckMatrixWidget\getConfig().


The documentation for this class was generated from the following file: