wiki.techinc.nl/includes/htmlform/fields/HTMLSelectNamespace.php
Bartosz Dziewoński 15692fa6d4 Move HTMLFormField subclasses to a separate directory
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
2016-08-01 07:58:56 +00:00

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,
] );
}
}