Merge "Chrome Origin Trial support"
[lhc/web/wiklou.git] / includes / widget / TitlesMultiselectWidget.php
1 <?php
2
3 namespace MediaWiki\Widget;
4
5 /**
6 * Widget to select multiple titles.
7 *
8 * @copyright 2017 MediaWiki Widgets Team and others; see AUTHORS.txt
9 * @license MIT
10 */
11 class TitlesMultiselectWidget extends TagMultiselectWidget {
12
13 protected $showMissing = null;
14 protected $excludeDynamicNamespaces = null;
15
16 /**
17 * @param array $config Configuration options
18 * - bool $config['showMissing'] Show missing pages
19 * - bool $config['excludeDynamicNamespaces'] Exclude pages in negative namespaces
20 */
21 public function __construct( array $config = [] ) {
22 parent::__construct( $config );
23
24 // Properties
25 if ( isset( $config['showMissing'] ) ) {
26 $this->showMissing = $config['showMissing'];
27 }
28 if ( isset( $config['excludeDynamicNamespaces'] ) ) {
29 $this->excludeDynamicNamespaces = $config['excludeDynamicNamespaces'];
30 }
31
32 $this->addClasses( [ 'mw-widgets-titlesMultiselectWidget' ] );
33 }
34
35 protected function getJavaScriptClassName() {
36 return 'mw.widgets.TitlesMultiselectWidget';
37 }
38
39 public function getConfig( &$config ) {
40 if ( $this->showMissing !== null ) {
41 $config['showMissing'] = $this->showMissing;
42 }
43 if ( $this->excludeDynamicNamespaces !== null ) {
44 $config['excludeDynamicNamespaces'] = $this->excludeDynamicNamespaces;
45 }
46
47 return parent::getConfig( $config );
48 }
49
50 }