Merge "Revert Count API module instantiations and Hook runs"
[lhc/web/wiklou.git] / includes / htmlform / 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 $this->mAllValue = isset( $this->mParams['all'] ) ? $this->mParams['all'] : 'all';
9 }
10
11 function getInputHTML( $value ) {
12 return Html::namespaceSelector(
13 array(
14 'selected' => $value,
15 'all' => $this->mAllValue
16 ), array(
17 'name' => $this->mName,
18 'id' => $this->mID,
19 'class' => 'namespaceselector',
20 )
21 );
22 }
23
24 public function getInputOOUI( $value ) {
25 $namespaceOptions = Html::namespaceSelectorOptions( array( 'all' => $this->mAllValue ) );
26
27 $options = array();
28 foreach( $namespaceOptions as $id => $name ) {
29 $options[] = array(
30 'data' => (string)$id,
31 'label' => $name,
32 );
33 };
34
35 return new OOUI\DropdownInputWidget( array(
36 'options' => $options,
37 'value' => $value,
38 'name' => $this->mName,
39 'id' => $this->mID,
40 ) );
41 }
42 }