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

 $columns = []
 
 $forcedOff = []
 
 $forcedOn = []
 
 $name = ''
 
 $rows = []
 
 $tooltips = []
 
 $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 39 of file CheckMatrixWidget.php.

References MediaWiki\$config, as, MediaWiki\Widget\CheckMatrixWidget\getCellTag(), MediaWiki\Widget\CheckMatrixWidget\getTableRow(), name, null, and values.

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

Returns
\OOUI\Tag Resulting cell

Definition at line 133 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 180 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 95 of file CheckMatrixWidget.php.

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

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 176 of file CheckMatrixWidget.php.

References null.

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
boolean Tag should be checked

Definition at line 146 of file CheckMatrixWidget.php.

References array(), and values.

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
boolean Tag should be disabled

Definition at line 160 of file CheckMatrixWidget.php.

References array().

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

Member Data Documentation

◆ $columns

MediaWiki\Widget\CheckMatrixWidget::$columns = []
protected

Definition at line 14 of file CheckMatrixWidget.php.

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

◆ $forcedOff

MediaWiki\Widget\CheckMatrixWidget::$forcedOff = []
protected

Definition at line 19 of file CheckMatrixWidget.php.

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

◆ $forcedOn

MediaWiki\Widget\CheckMatrixWidget::$forcedOn = []
protected

Definition at line 18 of file CheckMatrixWidget.php.

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

◆ $name

MediaWiki\Widget\CheckMatrixWidget::$name = ''
protected

Definition at line 13 of file CheckMatrixWidget.php.

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

◆ $rows

MediaWiki\Widget\CheckMatrixWidget::$rows = []
protected

Definition at line 15 of file CheckMatrixWidget.php.

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

◆ $tooltips

MediaWiki\Widget\CheckMatrixWidget::$tooltips = []
protected

Definition at line 16 of file CheckMatrixWidget.php.

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

◆ $values

MediaWiki\Widget\CheckMatrixWidget::$values = []
protected

Definition at line 17 of file CheckMatrixWidget.php.

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


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