MediaWiki  1.30.0
HTMLSelectNamespace.php
Go to the documentation of this file.
1 <?php
6  public function __construct( $params ) {
7  parent::__construct( $params );
8 
9  $this->mAllValue = array_key_exists( 'all', $params )
10  ? $params['all']
11  : 'all';
12  }
13 
14  public function getInputHTML( $value ) {
16  [
17  'selected' => $value,
18  'all' => $this->mAllValue
19  ], [
20  'name' => $this->mName,
21  'id' => $this->mID,
22  'class' => 'namespaceselector',
23  ]
24  );
25  }
26 
27  public function getInputOOUI( $value ) {
29  'value' => $value,
30  'name' => $this->mName,
31  'id' => $this->mID,
32  'includeAllValue' => $this->mAllValue,
33  ] );
34  }
35 
36  protected function getOOUIModules() {
37  // FIXME: NamespaceInputWidget should be in its own module (probably?)
38  return [ 'mediawiki.widgets' ];
39  }
40 
41  protected function shouldInfuseOOUI() {
42  return true;
43  }
44 }
HTMLSelectNamespace\__construct
__construct( $params)
Initialise the object.
Definition: HTMLSelectNamespace.php:6
HTMLSelectNamespace\getInputHTML
getInputHTML( $value)
This function must be implemented to return the HTML to generate the input object itself.
Definition: HTMLSelectNamespace.php:14
HTMLSelectNamespace
Wrapper for Html::namespaceSelector to use in HTMLForm.
Definition: HTMLSelectNamespace.php:5
$params
$params
Definition: styleTest.css.php:40
php
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:35
HTMLFormField
The parent class to generate form fields.
Definition: HTMLFormField.php:7
HTMLSelectNamespace\getOOUIModules
getOOUIModules()
Get the list of extra ResourceLoader modules which must be loaded client-side before it's possible to...
Definition: HTMLSelectNamespace.php:36
$value
$value
Definition: styleTest.css.php:45
MediaWiki\Widget\NamespaceInputWidget
Namespace input widget.
Definition: NamespaceInputWidget.php:13
Html\namespaceSelector
static namespaceSelector(array $params=[], array $selectAttribs=[])
Build a drop-down box for selecting a namespace.
Definition: Html.php:813
HTMLSelectNamespace\getInputOOUI
getInputOOUI( $value)
Same as getInputHTML, but returns an OOUI object.
Definition: HTMLSelectNamespace.php:27
HTMLSelectNamespace\shouldInfuseOOUI
shouldInfuseOOUI()
Whether the field should be automatically infused.
Definition: HTMLSelectNamespace.php:41