TitlesMultiselectWidget and NamespacesMultiselectWidget both default to false, meaning click-to-edit on the tags is disabled. Allow this to be overridden from the corresponding PHP form fields. This helps to provide a workaround for the related bug: T334711 Change-Id: I4014c5ba7fea0647da6ec6c420342a41ac90518b
41 lines
962 B
PHP
41 lines
962 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Widget;
|
|
|
|
/**
|
|
* Widget to select multiple namespaces.
|
|
*
|
|
* @copyright 2017 MediaWiki Widgets Team and others; see AUTHORS.txt
|
|
* @license MIT
|
|
*/
|
|
class NamespacesMultiselectWidget extends TagMultiselectWidget {
|
|
|
|
protected $allowEditTags = null;
|
|
|
|
/**
|
|
* @param array $config Configuration options
|
|
* - bool $config['allowEditTags'] Allow editing of the tags by clicking them
|
|
*/
|
|
public function __construct( array $config = [] ) {
|
|
parent::__construct( $config );
|
|
|
|
if ( isset( $config['allowEditTags'] ) ) {
|
|
$this->allowEditTags = $config['allowEditTags'];
|
|
}
|
|
|
|
$this->addClasses( [ 'mw-widgets-namespacesMultiselectWidget' ] );
|
|
}
|
|
|
|
protected function getJavaScriptClassName() {
|
|
return 'mw.widgets.NamespacesMultiselectWidget';
|
|
}
|
|
|
|
public function getConfig( &$config ) {
|
|
if ( $this->allowEditTags !== null ) {
|
|
$config['allowEditTags'] = $this->allowEditTags;
|
|
}
|
|
|
|
return parent::getConfig( $config );
|
|
}
|
|
|
|
}
|