MediaWiki  1.33.0
HTMLSelectNamespace.php
Go to the documentation of this file.
1 <?php
6 
8  protected $mAllValue;
9 
10  public function __construct( $params ) {
11  parent::__construct( $params );
12 
13  $this->mAllValue = array_key_exists( 'all', $params )
14  ? $params['all']
15  : 'all';
16  }
17 
18  public function getInputHTML( $value ) {
19  return Html::namespaceSelector(
20  [
21  'selected' => $value,
22  'all' => $this->mAllValue
23  ], [
24  'name' => $this->mName,
25  'id' => $this->mID,
26  'class' => 'namespaceselector',
27  ]
28  );
29  }
30 
31  public function getInputOOUI( $value ) {
33  'value' => $value,
34  'name' => $this->mName,
35  'id' => $this->mID,
36  'includeAllValue' => $this->mAllValue,
37  ] );
38  }
39 
40  protected function getOOUIModules() {
41  // FIXME: NamespaceInputWidget should be in its own module (probably?)
42  return [ 'mediawiki.widgets' ];
43  }
44 
45  protected function shouldInfuseOOUI() {
46  return true;
47  }
48 }
HTMLSelectNamespace\$mAllValue
string null $mAllValue
Definition: HTMLSelectNamespace.php:8
HTMLSelectNamespace\__construct
__construct( $params)
Initialise the object.
Definition: HTMLSelectNamespace.php:10
HTMLSelectNamespace\getInputHTML
getInputHTML( $value)
This function must be implemented to return the HTML to generate the input object itself.
Definition: HTMLSelectNamespace.php:18
HTMLSelectNamespace
Wrapper for Html::namespaceSelector to use in HTMLForm.
Definition: HTMLSelectNamespace.php:5
$params
$params
Definition: styleTest.css.php:44
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:40
$value
$value
Definition: styleTest.css.php:49
MediaWiki\Widget\NamespaceInputWidget
Namespace input widget.
Definition: NamespaceInputWidget.php:11
HTMLSelectNamespace\getInputOOUI
getInputOOUI( $value)
Same as getInputHTML, but returns an OOUI object.
Definition: HTMLSelectNamespace.php:31
HTMLSelectNamespace\shouldInfuseOOUI
shouldInfuseOOUI()
Whether the field should be automatically infused.
Definition: HTMLSelectNamespace.php:45