Go to the documentation of this file.
35 $missing = array_diff( self::$requiredParams, array_keys(
$params ) );
43 $rows = $this->mParams[
'rows'];
44 $columns = $this->mParams[
'columns'];
47 $p = parent::validate(
$value, $alldata );
53 if ( !is_array(
$value ) ) {
61 foreach ( $columns
as $columnTag ) {
62 $validOptions[] = $columnTag .
'-' . $rowTag;
65 $validValues = array_intersect(
$value, $validOptions );
69 return $this->
msg(
'htmlform-select-badoption' );
86 $rows = $this->mParams[
'rows'];
87 $columns = $this->mParams[
'columns'];
93 foreach ( $columns
as $columnLabel => $columnTag ) {
98 $tooltipClass =
'mw-icon-question';
99 if ( isset( $this->mParams[
'tooltip-class'] ) ) {
100 $tooltipClass = $this->mParams[
'tooltip-class'];
104 foreach (
$rows as $rowLabel => $rowTag ) {
106 if ( isset( $this->mParams[
'tooltips'][$rowLabel] ) ) {
108 'class' =>
"mw-htmlform-tooltip $tooltipClass",
109 'title' => $this->mParams[
'tooltips'][$rowLabel],
110 'aria-label' => $this->mParams[
'tooltips'][$rowLabel]
112 $rowLabel .=
' ' .
Html::element(
'span', $tooltipAttribs,
'' );
115 foreach ( $columns
as $columnTag ) {
116 $thisTag =
"$columnTag-$rowTag";
119 'id' =>
"{$this->mID}-$thisTag",
122 $checked = in_array( $thisTag, (
array)
$value,
true );
125 $thisAttribs[
'disabled'] = 1;
126 $thisAttribs[
'class'] =
'checkmatrix-forced checkmatrix-forced-off';
129 $thisAttribs[
'disabled'] = 1;
130 $thisAttribs[
'class'] =
'checkmatrix-forced checkmatrix-forced-on';
146 [
'class' =>
'mw-htmlform-matrix' ],
157 'name' => $this->mName,
160 'rows' => $this->mParams[
'rows'],
161 'columns' => $this->mParams[
'columns'],
162 'tooltips' => $this->mParams[
'tooltips'] ?? [],
163 'forcedOff' => $this->mParams[
'force-options-off'] ?? [],
164 'forcedOn' => $this->mParams[
'force-options-on'] ?? [],
166 ] + OOUI\Element::configFromHtmlAttributes(
$attribs )
172 if ( $this->mParent->getConfig()->get(
'UseMediaWikiUIEverywhere' ) ) {
182 return isset( $this->mParams[
'force-options-off'] )
183 && in_array( $tag, $this->mParams[
'force-options-off'] );
187 return isset( $this->mParams[
'force-options-on'] )
188 && in_array( $tag, $this->mParams[
'force-options-on'] );
207 $cellAttributes = [
'colspan' => 2 ];
210 $hideAttributes = [];
211 if ( $this->mHideIf ) {
213 $hideClass =
'mw-htmlform-hide-if';
220 [
'class' =>
'mw-input' ] + $cellAttributes,
221 $inputHtml .
"\n$errors"
225 [
'class' =>
"mw-htmlform-vertical-label $hideClass" ] + $hideAttributes,
228 [
'class' =>
"mw-htmlform-field-$fieldType {$this->mClass} $errorClass $hideClass" ] +
232 return $html . $helptext;
244 return $request->getArray( $this->mName, [] );
252 return $this->mDefault ?? [];
259 foreach ( $columns
as $column ) {
262 $thisTag =
"$column-$row";
264 $res[$thisTag] =
false;
266 $res[$thisTag] =
true;
268 $res[$thisTag] = in_array( $thisTag, $data );
277 return [
'mediawiki.widgets.CheckMatrixWidget' ];
shouldInfuseOOUI()
Whether the field should be automatically infused.
getInputOOUI( $value)
Same as getInputHTML, but returns an OOUI object.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
static closeElement( $element)
Returns "</$element>".
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
static check( $name, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox.
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
getOOUIModules()
Get the list of extra ResourceLoader modules which must be loaded client-side before it's possible to...
validate( $value, $alldata)
Override this function to add specific validation checks on the field input.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
getTableRow( $value)
Get the complete table row for the input, including help text, labels, and whatever.
getOneCheckboxHTML( $checked, $attribs)
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 you ll probably need to make sure the header is varied on $request
filterDataForSubmit( $data)
Support for separating multi-option preferences into multiple preferences Due to lack of array suppor...
loadDataFromRequest( $request)
getInputHTML( $value)
Build a table containing a matrix of checkbox options.
A checkbox matrix Operates similarly to HTMLMultiSelectField, but instead of using an array of option...
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
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
__construct( $params)
Initialise the object.
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).