MediaWiki  master
HTMLSelectNamespace.php
Go to the documentation of this file.
1 <?php
8 
10  protected $mAllValue;
12  protected $mUserLang;
13 
18  public function __construct( $params ) {
19  parent::__construct( $params );
20 
21  $this->mAllValue = array_key_exists( 'all', $params )
22  ? $params['all']
23  : 'all';
24  $this->mUserLang = array_key_exists( 'in-user-lang', $params )
25  ? $params['in-user-lang']
26  : false;
27  }
28 
33  public function getInputHTML( $value ) {
35  [
36  'selected' => $value,
37  'all' => $this->mAllValue,
38  'in-user-lang' => $this->mUserLang,
39  ], [
40  'name' => $this->mName,
41  'id' => $this->mID,
42  'class' => 'namespaceselector',
43  ]
44  );
45  }
46 
51  public function getInputOOUI( $value ) {
53  'value' => $value,
54  'name' => $this->mName,
55  'id' => $this->mID,
56  'includeAllValue' => $this->mAllValue,
57  'userLang' => $this->mUserLang,
58  ] );
59  }
60 
65  protected function getOOUIModules() {
66  // FIXME: NamespaceInputWidget should be in its own module (probably?)
67  return [ 'mediawiki.widgets' ];
68  }
69 
74  protected function shouldInfuseOOUI() {
75  return true;
76  }
77 }
The parent class to generate form fields.
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....
static namespaceSelector(array $params=[], array $selectAttribs=[])
Build a drop-down box for selecting a namespace.
Definition: Html.php:943