15 if ( array_key_exists(
'other',
$params ) ) {
17 } elseif ( array_key_exists(
'other-message',
$params ) ) {
20 $params[
'other'] = $this->
msg(
'htmlform-selectorother-other' )->plain();
27 throw new MWException(
'HTMLSelectAndOtherField called without any options' );
29 if ( !in_array(
'other', $this->mOptions,
true ) ) {
37 $select = parent::getInputHTML(
$value[1] );
40 'id' => $this->mID .
'-other',
42 'class' => [
'mw-htmlform-select-and-other-field' ],
46 if ( $this->mClass !==
'' ) {
50 if ( isset( $this->mParams[
'maxlength-unit'] ) ) {
51 $textAttribs[
'data-mw-maxlength-unit'] = $this->mParams[
'maxlength-unit'];
66 $textbox = Html::input( $this->mName .
'-other',
$value[2],
'text', $textAttribs );
68 return "$select<br />\n$textbox";
72 return [
'mediawiki.widgets.SelectWithInputWidget' ];
76 $this->mParent->getOutput()->addModuleStyles(
'mediawiki.widgets.SelectWithInputWidget.styles' );
80 'name' => $this->mName .
'-other',
93 $textAttribs += OOUI\Element::configFromHtmlAttributes(
97 if ( $this->mClass !==
'' ) {
102 $dropdownInputAttribs = [
104 'id' => $this->mID .
'-select',
114 $dropdownInputAttribs += OOUI\Element::configFromHtmlAttributes(
118 if ( $this->mClass !==
'' ) {
123 if ( isset( $this->mParams[
'disabled' ] ) && $this->mParams[
'disabled' ] ) {
129 'disabled' => $disabled,
130 'textinput' => $textAttribs,
131 'dropdowninput' => $dropdownInputAttribs,
133 'classes' => [
'mw-htmlform-select-and-other-field' ],
135 'maxlengthUnit' => $this->mParams[
'maxlength-unit'] ??
'bytes'
150 if (
$request->getCheck( $this->mName ) ) {
151 $list =
$request->getText( $this->mName );
152 $text =
$request->getText( $this->mName .
'-other' );
155 if ( $list ==
'other' ) {
157 } elseif ( !in_array( $list, $this->mFlatOptions,
true ) ) {
158 # User has spoofed the select form to give an option which wasn't
159 # in the original offer. Sulk...
161 } elseif ( $text ==
'' ) {
164 $final = $list . $this->
msg(
'colon-separator' )->inContentLanguage()->text() . $text;
171 foreach ( $this->mFlatOptions as $option ) {
172 $match = $option . $this->
msg(
'colon-separator' )->inContentLanguage()->text();
173 if ( strpos( $text, $match ) === 0 ) {
175 $text = substr( $text, strlen( $match ) );
181 return [ $final, $list, $text ];
185 return $this->mParams[
'size'] ?? 45;
189 # HTMLSelectField forces $value to be one of the options in the select
190 # field, which is not useful here. But we do want the validation further up
192 $p = parent::validate(
$value[1], $alldata );
198 if ( isset( $this->mParams[
'required'] )
199 && $this->mParams[
'required'] !==
false
202 return $this->
msg(
'htmlform-required' );
Double field with a dropdown list constructed from a system message in the format.
getInputOOUI( $value)
Same as getInputHTML, but returns an OOUI object.
getInputHTML( $value)
This function must be implemented to return the HTML to generate the input object itself.
__construct( $params)
Initialise the object.
getOOUIModules()
Get the list of extra ResourceLoader modules which must be loaded client-side before it's possible to...
loadDataFromRequest( $request)
validate( $value, $alldata)
Override this function to add specific validation checks on the field input.
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