Merge "Move up devunt's name to Developers"
[lhc/web/wiklou.git] / includes / htmlform / fields / HTMLSelectNamespace.php
1 <?php
2 /**
3 * Wrapper for Html::namespaceSelector to use in HTMLForm
4 */
5 class HTMLSelectNamespace extends HTMLFormField {
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
15 function getInputHTML( $value ) {
16 return Html::namespaceSelector(
17 [
18 'selected' => $value,
19 'all' => $this->mAllValue
20 ], [
21 'name' => $this->mName,
22 'id' => $this->mID,
23 'class' => 'namespaceselector',
24 ]
25 );
26 }
27
28 public function getInputOOUI( $value ) {
29 return new MediaWiki\Widget\NamespaceInputWidget( [
30 'value' => $value,
31 'name' => $this->mName,
32 'id' => $this->mID,
33 'includeAllValue' => $this->mAllValue,
34 ] );
35 }
36
37 protected function getOOUIModules() {
38 // FIXME: NamespaceInputWidget should be in its own module (probably?)
39 return [ 'mediawiki.widgets' ];
40 }
41
42 protected function shouldInfuseOOUI() {
43 return true;
44 }
45 }