It's getting more difficult to navigate the files in includes/htmlform/ with every new field and every new helper class that is being added. Change-Id: I92ce2356baf6151f17b2440970d5abdf86503820
36 lines
754 B
PHP
36 lines
754 B
PHP
<?php
|
|
/**
|
|
* Wrapper for Html::namespaceSelector to use in HTMLForm
|
|
*/
|
|
class HTMLSelectNamespace extends HTMLFormField {
|
|
public function __construct( $params ) {
|
|
parent::__construct( $params );
|
|
|
|
$this->mAllValue = array_key_exists( 'all', $params )
|
|
? $params['all']
|
|
: 'all';
|
|
|
|
}
|
|
|
|
function getInputHTML( $value ) {
|
|
return Html::namespaceSelector(
|
|
[
|
|
'selected' => $value,
|
|
'all' => $this->mAllValue
|
|
], [
|
|
'name' => $this->mName,
|
|
'id' => $this->mID,
|
|
'class' => 'namespaceselector',
|
|
]
|
|
);
|
|
}
|
|
|
|
public function getInputOOUI( $value ) {
|
|
return new MediaWiki\Widget\NamespaceInputWidget( [
|
|
'value' => $value,
|
|
'name' => $this->mName,
|
|
'id' => $this->mID,
|
|
'includeAllValue' => $this->mAllValue,
|
|
] );
|
|
}
|
|
}
|