MediaWiki REL1_28
Go to the documentation of this file.
18 // FIXME Ewww, this shouldn't be adding any attributes not requested in $list :(
19 public function getAttributes( array $list ) {
20 $attribs = [
21 'type' => 'text',
22 'list' => $this->mName . '-datalist',
23 ] + parent::getAttributes( $list );
25 return $attribs;
26 }
28 function getInputHTML( $value ) {
29 $datalist = new XmlSelect( false, $this->mName . '-datalist' );
30 $datalist->setTagName( 'datalist' );
31 $datalist->addOptions( $this->getOptions() );
33 return parent::getInputHTML( $value ) . $datalist->getHTML();
34 }
36 function getInputOOUI( $value ) {
37 $disabled = false;
38 $allowedParams = [ 'tabindex' ];
39 $attribs = OOUI\Element::configFromHtmlAttributes(
40 $this->getAttributes( $allowedParams )
41 );
43 if ( $this->mClass !== '' ) {
44 $attribs['classes'] = [ $this->mClass ];
45 }
47 if ( !empty( $this->mParams['disabled'] ) ) {
48 $disabled = true;
49 }
51 return new OOUI\ComboBoxInputWidget( [
52 'name' => $this->mName,
53 'id' => $this->mID,
54 'options' => $this->getOptionsOOUI(),
55 'value' => strval( $value ),
56 'disabled' => $disabled,
57 ] + $attribs );
58 }
60 protected function shouldInfuseOOUI() {
61 return true;
62 }
A combo box field.
Whether the field should be automatically infused.
getInputOOUI( $value)
Same as getInputHTML, but returns an OOUI object.
getAttributes(array $list)
Returns the given attributes from the parameters.
getInputHTML( $value)
This function must be implemented to return the HTML to generate the input object itself.
Fetch the array of options from the field's parameters.
Get options and make them into arrays suitable for OOUI.
Class for generating HTML <select> or <datalist> elements.
Definition XmlSelect.php:26
the array() calling protocol came about after MediaWiki 1.4rc1.
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
Definition hooks.txt:1958
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
Definition injection.txt:37