* Refactor NamespaceInputWidget into two widgets: NamespaceInputWidget and ComplexNamespaceInputWidget. The former is now only the dropdown (and inherits from DropdownInputWidget), the latter is the dropdown plus two checkboxes. * Change ComplexNamespaceInputWidget configuration to take nested config for `invert`, `associated`, and `namespace`, rather than require parameters like `invertName` and so on for every combination. * Implement standalone JavaScript versions of both widgets (previously mw.widgets.NamespaceInputWidget could only be created via infusion of the PHP widget). Bug: T99256 Bug: T106138 Bug: T109559 Change-Id: Ie2fee6d035339ceb934fca991675480db3d630d1
32 lines
764 B
PHP
32 lines
764 B
PHP
<?php
|
|
/**
|
|
* Wrapper for Html::namespaceSelector to use in HTMLForm
|
|
*/
|
|
class HTMLSelectNamespace extends HTMLFormField {
|
|
public function __construct( $params ) {
|
|
parent::__construct( $params );
|
|
$this->mAllValue = isset( $this->mParams['all'] ) ? $this->mParams['all'] : 'all';
|
|
}
|
|
|
|
function getInputHTML( $value ) {
|
|
return Html::namespaceSelector(
|
|
array(
|
|
'selected' => $value,
|
|
'all' => $this->mAllValue
|
|
), array(
|
|
'name' => $this->mName,
|
|
'id' => $this->mID,
|
|
'class' => 'namespaceselector',
|
|
)
|
|
);
|
|
}
|
|
|
|
public function getInputOOUI( $value ) {
|
|
return new MediaWiki\Widget\NamespaceInputWidget( array(
|
|
'value' => $value,
|
|
'name' => $this->mName,
|
|
'id' => $this->mID,
|
|
'includeAllValue' => $this->mAllValue,
|
|
) );
|
|
}
|
|
}
|