Go to the documentation of this file.
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 !==
'' ) {
61 $textbox =
Html::input( $this->mName .
'-other',
$value[2],
'text', $textAttribs );
63 return "$select<br />\n$textbox";
67 return [
'mediawiki.widgets.SelectWithInputWidget' ];
71 $this->mParent->getOutput()->addModuleStyles(
'mediawiki.widgets.SelectWithInputWidget.styles' );
75 'id' => $this->mID .
'-other',
76 'name' => $this->mName .
'-other',
78 'class' => [
'mw-htmlform-select-and-other-field' ],
92 $textAttribs += OOUI\Element::configFromHtmlAttributes(
96 if ( $this->mClass !==
'' ) {
101 $dropdownInputAttribs = [
113 $dropdownInputAttribs += OOUI\Element::configFromHtmlAttributes(
117 if ( $this->mClass !==
'' ) {
122 'textinput' => $textAttribs,
123 'dropdowninput' => $dropdownInputAttribs,
129 return new Mediawiki\Widget\SelectWithInputWidget(
$params );
138 if (
$request->getCheck( $this->mName ) ) {
139 $list =
$request->getText( $this->mName );
140 $text =
$request->getText( $this->mName .
'-other' );
143 if ( $list ==
'other' ) {
145 } elseif ( !in_array( $list, $this->mFlatOptions,
true ) ) {
146 # User has spoofed the select form to give an option which wasn't
147 # in the original offer. Sulk...
149 } elseif ( $text ==
'' ) {
152 $final = $list . $this->
msg(
'colon-separator' )->inContentLanguage()->text() . $text;
159 foreach ( $this->mFlatOptions
as $option ) {
160 $match = $option . $this->
msg(
'colon-separator' )->inContentLanguage()->text();
161 if ( strpos( $text, $match ) === 0 ) {
163 $text = substr( $text, strlen( $match ) );
169 return [ $final, $list, $text ];
173 return isset( $this->mParams[
'size'] ) ? $this->mParams[
'size'] : 45;
177 # HTMLSelectField forces $value to be one of the options in the select
178 # field, which is not useful here. But we do want the validation further up
180 $p = parent::validate(
$value[1], $alldata );
186 if ( isset( $this->mParams[
'required'] )
187 && $this->mParams[
'required'] !==
false
190 return $this->
msg(
'htmlform-required' );
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 input( $name, $value='', $type='text', array $attribs=[])
Convenience function to produce an "<input>" element.
Double field with a dropdown list constructed from a system message in the format.
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
loadDataFromRequest( $request)
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...
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
validate( $value, $alldata)
Override this function to add specific validation checks on the field input.
getInputOOUI( $value)
Same as getInputHTML, but returns an OOUI object.