MediaWiki master
HTMLSelectNamespace.php
Go to the documentation of this file.
1<?php
2
4
7
14
16 protected $mAllValue;
18 protected $mUserLang;
19
24 public function __construct( $params ) {
25 parent::__construct( $params );
26
27 $this->mAllValue = array_key_exists( 'all', $params )
28 ? $params['all']
29 : 'all';
30 $this->mUserLang = array_key_exists( 'in-user-lang', $params )
31 ? $params['in-user-lang']
32 : false;
33 }
34
39 public function getInputHTML( $value ) {
40 return Html::namespaceSelector(
41 [
42 'selected' => $value,
43 'all' => $this->mAllValue,
44 'in-user-lang' => $this->mUserLang,
45 ], [
46 'name' => $this->mName,
47 'id' => $this->mID,
48 'class' => 'namespaceselector',
49 ]
50 );
51 }
52
57 public function getInputOOUI( $value ) {
58 return new \MediaWiki\Widget\NamespaceInputWidget( [
59 'value' => $value,
60 'name' => $this->mName,
61 'id' => $this->mID,
62 'includeAllValue' => $this->mAllValue,
63 'userLang' => $this->mUserLang,
64 ] );
65 }
66
71 protected function getOOUIModules() {
72 // FIXME: NamespaceInputWidget should be in its own module (probably?)
73 return [ 'mediawiki.widgets' ];
74 }
75
80 protected function shouldInfuseOOUI() {
81 return true;
82 }
83}
84
86class_alias( HTMLSelectNamespace::class, 'HTMLSelectNamespace' );
array $params
The job parameters.
Wrapper for Html::namespaceSelector to use in HTMLForm.
getInputOOUI( $value)
Same as getInputHTML, but returns an OOUI object.Defaults to false, which getOOUI will interpret as "...
shouldInfuseOOUI()
Whether the field should be automatically infused.Note that all OOUI HTMLForm fields are infusable (y...
getOOUIModules()
Get the list of extra ResourceLoader modules which must be loaded client-side before it's possible to...
getInputHTML( $value)
This function must be implemented to return the HTML to generate the input object itself....
The parent class to generate form fields.
This class is a collection of static functions that serve two purposes:
Definition Html.php:56