Merge "Special:Upload should not crash on failing previews"
[mediawiki.git] / includes / htmlform / fields / HTMLSelectNamespace.php
blobf13aa1777c9b4314d10ba6686a136e0f75d5368c
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 );
9 $this->mAllValue = array_key_exists( 'all', $params )
10 ? $params['all']
11 : 'all';
14 public function getInputHTML( $value ) {
15 return Html::namespaceSelector(
17 'selected' => $value,
18 'all' => $this->mAllValue
19 ], [
20 'name' => $this->mName,
21 'id' => $this->mID,
22 'class' => 'namespaceselector',
27 public function getInputOOUI( $value ) {
28 return new MediaWiki\Widget\NamespaceInputWidget( [
29 'value' => $value,
30 'name' => $this->mName,
31 'id' => $this->mID,
32 'includeAllValue' => $this->mAllValue,
33 ] );
36 protected function getOOUIModules() {
37 // FIXME: NamespaceInputWidget should be in its own module (probably?)
38 return [ 'mediawiki.widgets' ];
41 protected function shouldInfuseOOUI() {
42 return true;