2018-12-14 17:55:01 +00:00
|
|
|
<?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 {
|
|
|
|
|
|
2024-09-13 20:19:49 +00:00
|
|
|
/** @var bool|null */
|
2023-04-18 17:38:24 +00:00
|
|
|
protected $allowEditTags = null;
|
|
|
|
|
|
2018-12-14 17:55:01 +00:00
|
|
|
/**
|
|
|
|
|
* @param array $config Configuration options
|
2023-04-18 17:38:24 +00:00
|
|
|
* - bool $config['allowEditTags'] Allow editing of the tags by clicking them
|
2018-12-14 17:55:01 +00:00
|
|
|
*/
|
|
|
|
|
public function __construct( array $config = [] ) {
|
|
|
|
|
parent::__construct( $config );
|
|
|
|
|
|
2023-04-18 17:38:24 +00:00
|
|
|
if ( isset( $config['allowEditTags'] ) ) {
|
|
|
|
|
$this->allowEditTags = $config['allowEditTags'];
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-14 17:55:01 +00:00
|
|
|
$this->addClasses( [ 'mw-widgets-namespacesMultiselectWidget' ] );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function getJavaScriptClassName() {
|
|
|
|
|
return 'mw.widgets.NamespacesMultiselectWidget';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getConfig( &$config ) {
|
2023-04-18 17:38:24 +00:00
|
|
|
if ( $this->allowEditTags !== null ) {
|
|
|
|
|
$config['allowEditTags'] = $this->allowEditTags;
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-14 17:55:01 +00:00
|
|
|
return parent::getConfig( $config );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|