21 if ( isset( $this->mParams[
'disabled-options'] ) ===
false ) {
22 $this->mParams[
'disabled-options'] = [];
25 if ( isset(
$params[
'dropdown'] ) ) {
26 $this->mClass .=
' mw-htmlform-dropdown';
29 if ( isset(
$params[
'flatlist'] ) ) {
30 $this->mClass .=
' mw-htmlform-flatlist';
35 $p = parent::validate(
$value, $alldata );
41 if ( !is_array(
$value ) ) {
45 # If all options are valid, array_intersect of the valid options
46 # and the provided options will return the provided options.
49 $validValues = array_intersect(
$value, $validOptions );
50 if ( count( $validValues ) == count(
$value ) ) {
53 return $this->
msg(
'htmlform-select-badoption' );
58 if ( isset( $this->mParams[
'dropdown'] ) ) {
59 $this->mParent->getOutput()->addModules(
'jquery.chosen' );
74 if ( is_array( $info ) ) {
75 $html .= Html::rawElement(
'h1', [], $label ) .
"\n";
79 'id' =>
"{$this->mID}-$info",
82 if ( in_array( $info, $this->mParams[
'disabled-options'],
true ) ) {
83 $thisAttribs[
'disabled'] =
'disabled';
85 $checked = in_array( $info,
$value,
true );
89 $html .=
' ' . Html::rawElement(
91 [
'class' =>
'mw-htmlform-flatlist-item' ],
102 throw new MWException(
'HTMLMultiSelectField#getOneCheckbox() is not supported' );
104 $elementFunc = [ Html::class, $this->mOptionsLabelsNotFromMessage ?
'rawElement' :
'element' ];
106 Xml::check(
"{$this->mName}[]", $checked,
$attribs ) .
108 call_user_func( $elementFunc,
113 if ( $this->mParent->getConfig()->get(
'UseMediaWikiUIEverywhere' ) ) {
114 $checkbox = Html::openElement(
'div', [
'class' =>
'mw-ui-checkbox' ] ) .
116 Html::closeElement(
'div' );
128 throw new MWException(
'HTMLMultiSelectField#getOptionsOOUI() is not supported' );
142 $this->mParent->getOutput()->addModules(
'oojs-ui-widgets' );
144 $hasSections =
false;
145 $optionsOouiSections = [];
151 $optionsOouiSections[ $label ] = Xml::listDropDownOptionsOoui(
$section );
159 $optionsOouiSections = array_merge(
160 [
'' => Xml::listDropDownOptionsOoui(
$options ) ],
166 foreach ( $optionsOouiSections
as $sectionLabel => $optionsOoui ) {
168 $attr[
'name'] =
"{$this->mName}[]";
171 $attr[
'options'] = $optionsOoui;
173 foreach ( $attr[
'options']
as &$option ) {
174 $option[
'disabled'] = in_array( $option[
'data'], $this->mParams[
'disabled-options'],
true );
176 if ( $this->mOptionsLabelsNotFromMessage ) {
177 foreach ( $attr[
'options']
as &$option ) {
178 $option[
'label'] =
new OOUI\HtmlSnippet( $option[
'label'] );
182 $attr += OOUI\Element::configFromHtmlAttributes(
186 if ( $this->mClass !==
'' ) {
190 $widget =
new OOUI\CheckboxMultiselectInputWidget( $attr );
191 if ( $sectionLabel ) {
192 $out[] =
new OOUI\FieldsetLayout( [
193 'items' => [ $widget ],
194 'label' =>
new OOUI\HtmlSnippet( $sectionLabel ),
201 if ( !$hasSections ) {
207 return implode(
'',
$out );
216 $fromRequest =
$request->getArray( $this->mName, [] );
231 if ( isset( $this->mDefault ) ) {
244 $res[
"$opt"] = in_array(
$opt, $data,
true );
validate( $value, $alldata)
Override this function to add specific validation checks on the field input.
needsLabel()
Should this field have a label, or is there no input element with the appropriate id for the label to...
getOneCheckbox( $checked, $attribs, $label)
filterDataForSubmit( $data)
Support for separating multi-option preferences into multiple preferences Due to lack of array suppor...
getInputHTML( $value)
This function must be implemented to return the HTML to generate the input object itself.
getInputOOUI( $value)
Get the OOUI version of this field.
formatOptions( $options, $value)
getOptionsOOUI()
Get options and make them into arrays suitable for OOUI.
loadDataFromRequest( $request)
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
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 & $options
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
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
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
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