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' )->parse();
85 $rows = $this->mParams[
'rows'];
86 $columns = $this->mParams[
'columns'];
92 foreach ( $columns
as $columnLabel => $columnTag ) {
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],
110 $rowLabel .=
' ' .
Html::element(
'span', $tooltipAttribs,
'' );
113 foreach ( $columns
as $columnTag ) {
114 $thisTag =
"$columnTag-$rowTag";
117 'id' =>
"{$this->mID}-$thisTag",
120 $checked = in_array( $thisTag, (
array)
$value,
true );
123 $thisAttribs[
'disabled'] = 1;
126 $thisAttribs[
'disabled'] = 1;
142 [
'class' =>
'mw-htmlform-matrix' ],
150 return new OOUI\CheckboxInputWidget( [
151 'name' =>
"{$this->mName}[]",
152 'selected' => $checked,
153 ] + OOUI\Element::configFromHtmlAttributes(
158 if ( $this->mParent->getConfig()->get(
'UseMediaWikiUIEverywhere' ) ) {
169 return isset( $this->mParams[
'force-options-off'] )
170 && in_array(
$tag, $this->mParams[
'force-options-off'] );
174 return isset( $this->mParams[
'force-options-on'] )
175 && in_array(
$tag, $this->mParams[
'force-options-on'] );
192 $fieldType = get_class( $this );
194 $cellAttributes = [
'colspan' => 2 ];
197 $hideAttributes = [];
198 if ( $this->mHideIf ) {
200 $hideClass =
'mw-htmlform-hide-if';
207 [
'class' =>
'mw-input' ] + $cellAttributes,
208 $inputHtml .
"\n$errors"
212 [
'class' =>
"mw-htmlform-vertical-label $hideClass" ] + $hideAttributes,
215 [
'class' =>
"mw-htmlform-field-$fieldType {$this->mClass} $errorClass $hideClass" ] +
219 return $html . $helptext;
231 return $request->getArray( $this->mName, [] );
239 if ( isset( $this->mDefault ) ) {
250 foreach ( $columns
as $column ) {
251 foreach ( $rows
as $row ) {
253 $thisTag =
"$column-$row";
255 $res[$thisTag] =
false;
257 $res[$thisTag] =
true;
259 $res[$thisTag] = in_array( $thisTag, $data );
static closeElement($element)
Returns "$element>".
getTableRow($value)
Get the complete table row for the input, including help text, labels, and whatever.
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
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
the array() calling protocol came about after MediaWiki 1.4rc1.
static rawElement($element, $attribs=[], $contents= '')
Returns an HTML element in a string.
static check($name, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox.
static openElement($element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
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
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books $tag
validate($value, $alldata)
filterDataForSubmit($data)
Support for seperating multi-option preferences into multiple preferences Due to lack of array suppor...
getOneCheckbox($checked, $attribs)
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
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...
loadDataFromRequest($request)
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
error also a ContextSource you ll probably need to make sure the header is varied on $request
static element($element, $attribs=[], $contents= '')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).