Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 17
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
TitlesMultiselectWidget
0.00% covered (danger)
0.00%
0 / 17
0.00% covered (danger)
0.00%
0 / 3
90
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
20
 getJavaScriptClassName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getConfig
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
20
1<?php
2
3namespace 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 */
11class TitlesMultiselectWidget extends TagMultiselectWidget {
12
13    protected $showMissing = null;
14    protected $excludeDynamicNamespaces = null;
15    protected $allowEditTags = null;
16
17    /**
18     * @param array $config Configuration options
19     *   - bool $config['showMissing'] Show missing pages in the typeahead dropdown
20     *     (ie. allow adding pages that don't exist)
21     *   - bool $config['excludeDynamicNamespaces'] Exclude pages in negative namespaces
22     *   - bool $config['allowEditTags'] Allow editing of the tags by clicking them
23     */
24    public function __construct( array $config = [] ) {
25        parent::__construct( $config );
26
27        // Properties
28        if ( isset( $config['showMissing'] ) ) {
29            $this->showMissing = $config['showMissing'];
30        }
31        if ( isset( $config['excludeDynamicNamespaces'] ) ) {
32            $this->excludeDynamicNamespaces = $config['excludeDynamicNamespaces'];
33        }
34        if ( isset( $config['allowEditTags'] ) ) {
35            $this->allowEditTags = $config['allowEditTags'];
36        }
37
38        $this->addClasses( [ 'mw-widgets-titlesMultiselectWidget' ] );
39    }
40
41    protected function getJavaScriptClassName() {
42        return 'mw.widgets.TitlesMultiselectWidget';
43    }
44
45    public function getConfig( &$config ) {
46        if ( $this->showMissing !== null ) {
47            $config['showMissing'] = $this->showMissing;
48        }
49        if ( $this->excludeDynamicNamespaces !== null ) {
50            $config['excludeDynamicNamespaces'] = $this->excludeDynamicNamespaces;
51        }
52        if ( $this->allowEditTags !== null ) {
53            $config['allowEditTags'] = $this->allowEditTags;
54        }
55
56        return parent::getConfig( $config );
57    }
58
59}