21 if ( isset( $this->mParams[
'disabled-options'] ) ===
false ) {
22 $this->mParams[
'disabled-options'] = [];
26 if ( isset(
$params[
'dropdown'] ) || strpos( $this->mClass,
'mw-chosen' ) !==
false ) {
27 $this->mClass .=
' mw-htmlform-dropdown';
30 if ( isset(
$params[
'flatlist'] ) ) {
31 $this->mClass .=
' mw-htmlform-flatlist';
36 $p = parent::validate(
$value, $alldata );
42 if ( !is_array(
$value ) ) {
46 # If all options are valid, array_intersect of the valid options
47 # and the provided options will return the provided options.
50 $validValues = array_intersect(
$value, $validOptions );
51 if ( count( $validValues ) == count(
$value ) ) {
54 return $this->
msg(
'htmlform-select-badoption' );
59 if ( isset( $this->mParams[
'dropdown'] ) ) {
60 $this->mParent->getOutput()->addModules(
'jquery.chosen' );
74 foreach (
$options as $label => $info ) {
75 if ( is_array( $info ) ) {
76 $html .= Html::rawElement(
'h1', [], $label ) .
"\n";
80 'id' =>
"{$this->mID}-$info",
83 if ( in_array( $info, $this->mParams[
'disabled-options'],
true ) ) {
84 $thisAttribs[
'disabled'] =
'disabled';
86 $checked = in_array( $info,
$value,
true );
90 $html .=
' ' . Html::rawElement(
92 [
'class' =>
'mw-htmlform-flatlist-item' ],
103 throw new MWException(
'HTMLMultiSelectField#getOneCheckbox() is not supported' );
105 $elementFunc = [ Html::class, $this->mOptionsLabelsNotFromMessage ?
'rawElement' :
'element' ];
107 Xml::check(
"{$this->mName}[]", $checked,
$attribs ) .
109 call_user_func( $elementFunc,
114 if ( $this->mParent->getConfig()->get(
'UseMediaWikiUIEverywhere' ) ) {
115 $checkbox = Html::openElement(
'div', [
'class' =>
'mw-ui-checkbox' ] ) .
117 Html::closeElement(
'div' );
129 throw new MWException(
'HTMLMultiSelectField#getOptionsOOUI() is not supported' );
143 $this->mParent->getOutput()->addModules(
'oojs-ui-widgets' );
145 $hasSections =
false;
146 $optionsOouiSections = [];
152 $optionsOouiSections[ $label ] = Xml::listDropDownOptionsOoui(
$section );
160 $optionsOouiSections = array_merge(
161 [
'' => Xml::listDropDownOptionsOoui(
$options ) ],
167 foreach ( $optionsOouiSections as $sectionLabel => $optionsOoui ) {
169 $attr[
'name'] =
"{$this->mName}[]";
172 $attr[
'options'] = $optionsOoui;
174 foreach ( $attr[
'options'] as &$option ) {
175 $option[
'disabled'] = in_array( $option[
'data'], $this->mParams[
'disabled-options'],
true );
177 if ( $this->mOptionsLabelsNotFromMessage ) {
178 foreach ( $attr[
'options'] as &$option ) {
179 $option[
'label'] =
new OOUI\HtmlSnippet( $option[
'label'] );
183 $attr += OOUI\Element::configFromHtmlAttributes(
187 if ( $this->mClass !==
'' ) {
191 $widget =
new OOUI\CheckboxMultiselectInputWidget( $attr );
192 if ( $sectionLabel ) {
193 $out[] =
new OOUI\FieldsetLayout( [
194 'items' => [ $widget ],
195 'label' =>
new OOUI\HtmlSnippet( $sectionLabel ),
202 if ( !$hasSections ) {
208 return implode(
'',
$out );
220 return $request->getArray( $this->mName, [] );
228 if ( isset( $this->mDefault ) ) {
241 $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 seperating 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)
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