34 $missing = array_diff( self::$requiredParams, array_keys(
$params ) );
42 $rows = $this->mParams[
'rows'];
43 $columns = $this->mParams[
'columns'];
46 $p = parent::validate(
$value, $alldata );
52 if ( !is_array(
$value ) ) {
59 foreach (
$rows as $rowTag ) {
60 foreach ( $columns as $columnTag ) {
61 $validOptions[] = $columnTag .
'-' . $rowTag;
64 $validValues = array_intersect(
$value, $validOptions );
65 if ( count( $validValues ) == count(
$value ) ) {
68 return $this->
msg(
'htmlform-select-badoption' );
85 $rows = $this->mParams[
'rows'];
86 $columns = $this->mParams[
'columns'];
91 $headerContents = Html::rawElement(
'td', [],
' ' );
92 foreach ( $columns as $columnLabel => $columnTag ) {
93 $headerContents .= Html::rawElement(
'td', [], $columnLabel );
95 $tableContents .= Html::rawElement(
'tr', [],
"\n$headerContents\n" );
97 $tooltipClass =
'mw-icon-question';
98 if ( isset( $this->mParams[
'tooltip-class'] ) ) {
99 $tooltipClass = $this->mParams[
'tooltip-class'];
103 foreach (
$rows as $rowLabel => $rowTag ) {
105 if ( isset( $this->mParams[
'tooltips'][$rowLabel] ) ) {
107 'class' =>
"mw-htmlform-tooltip $tooltipClass",
108 'title' => $this->mParams[
'tooltips'][$rowLabel],
109 'aria-label' => $this->mParams[
'tooltips'][$rowLabel]
111 $rowLabel .=
' ' . Html::element(
'span', $tooltipAttribs,
'' );
113 $rowContents = Html::rawElement(
'td', [], $rowLabel );
114 foreach ( $columns as $columnTag ) {
115 $thisTag =
"$columnTag-$rowTag";
118 'id' =>
"{$this->mID}-$thisTag",
121 $checked = in_array( $thisTag, (array)
$value,
true );
124 $thisAttribs[
'disabled'] = 1;
125 $thisAttribs[
'class'] =
'checkmatrix-forced checkmatrix-forced-off';
128 $thisAttribs[
'disabled'] = 1;
129 $thisAttribs[
'class'] =
'checkmatrix-forced checkmatrix-forced-on';
134 $rowContents .= Html::rawElement(
140 $tableContents .= Html::rawElement(
'tr', [],
"\n$rowContents\n" );
144 $html .= Html::rawElement(
'table',
145 [
'class' =>
'mw-htmlform-matrix' ],
146 Html::rawElement(
'tbody', [],
"\n$tableContents\n" ) ) .
"\n";
153 return new OOUI\CheckboxInputWidget( [
154 'name' =>
"{$this->mName}[]",
155 'selected' => $checked,
156 ] + OOUI\Element::configFromHtmlAttributes(
160 $checkbox = Xml::check(
"{$this->mName}[]", $checked,
$attribs );
161 if ( $this->mParent->getConfig()->get(
'UseMediaWikiUIEverywhere' ) ) {
162 $checkbox = Html::openElement(
'div', [
'class' =>
'mw-ui-checkbox' ] ) .
164 Html::element(
'label', [
'for' =>
$attribs[
'id'] ] ) .
165 Html::closeElement(
'div' );
172 return isset( $this->mParams[
'force-options-off'] )
173 && in_array( $tag, $this->mParams[
'force-options-off'] );
177 return isset( $this->mParams[
'force-options-on'] )
178 && in_array( $tag, $this->mParams[
'force-options-on'] );
197 $cellAttributes = [
'colspan' => 2 ];
200 $hideAttributes = [];
201 if ( $this->mHideIf ) {
202 $hideAttributes[
'data-hide-if'] = FormatJson::encode( $this->mHideIf );
203 $hideClass =
'mw-htmlform-hide-if';
208 $field = Html::rawElement(
210 [
'class' =>
'mw-input' ] + $cellAttributes,
211 $inputHtml .
"\n$errors"
214 $html = Html::rawElement(
'tr',
215 [
'class' =>
"mw-htmlform-vertical-label $hideClass" ] + $hideAttributes,
217 $html .= Html::rawElement(
'tr',
218 [
'class' =>
"mw-htmlform-field-$fieldType {$this->mClass} $errorClass $hideClass" ] +
222 return $html . $helptext;
234 return $request->getArray( $this->mName, [] );
242 if ( isset( $this->mDefault ) ) {
253 foreach ( $columns as $column ) {
254 foreach (
$rows as $row ) {
256 $thisTag =
"$column-$row";
258 $res[$thisTag] =
false;
260 $res[$thisTag] =
true;
262 $res[$thisTag] = in_array( $thisTag, $data );
A checkbox matrix Operates similarly to HTMLMultiSelectField, but instead of using an array of option...
validate( $value, $alldata)
Override this function to add specific validation checks on the field input.
getOneCheckbox( $checked, $attribs)
__construct( $params)
Initialise the object.
getInputHTML( $value)
Build a table containing a matrix of checkbox options.
getTableRow( $value)
Get the complete table row for the input, including help text, labels, and whatever.
loadDataFromRequest( $request)
filterDataForSubmit( $data)
Support for seperating multi-option preferences into multiple preferences Due to lack of array suppor...
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction $rows
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs