Debian Codegraph @

includes/widget/TitlesMultiselectWidget.php

raw symbols SCIP
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 /** @var bool|null */
14 protected $showMissing = null;
15 /** @var bool|null */
16 protected $excludeDynamicNamespaces = null;
17 /** @var bool|null */
18 protected $allowEditTags = null;
19
20 /**
21 * @param array $config Configuration options
22 * - bool $config['showMissing'] Show missing pages in the typeahead dropdown
23 * (ie. allow adding pages that don't exist)
24 * - bool $config['excludeDynamicNamespaces'] Exclude pages in negative namespaces
25 * - bool $config['allowEditTags'] Allow editing of the tags by clicking them
26 */
27 public function __construct( array $config = [] ) {
28 parent::__construct( $config );
29
30 // Properties
31 if ( isset( $config['showMissing'] ) ) {
32 $this->showMissing = $config['showMissing'];
33 }
34 if ( isset( $config['excludeDynamicNamespaces'] ) ) {
35 $this->excludeDynamicNamespaces = $config['excludeDynamicNamespaces'];
36 }
37 if ( isset( $config['allowEditTags'] ) ) {
38 $this->allowEditTags = $config['allowEditTags'];
39 }
40
41 $this->addClasses( [ 'mw-widgets-titlesMultiselectWidget' ] );
42 }
43
44 protected function getJavaScriptClassName() {
45 return 'mw.widgets.TitlesMultiselectWidget';
46 }
47
48 public function getConfig( &$config ) {
49 if ( $this->showMissing !== null ) {
50 $config['showMissing'] = $this->showMissing;
51 }
52 if ( $this->excludeDynamicNamespaces !== null ) {
53 $config['excludeDynamicNamespaces'] = $this->excludeDynamicNamespaces;
54 }
55 if ( $this->allowEditTags !== null ) {
56 $config['allowEditTags'] = $this->allowEditTags;
57 }
58
59 return parent::getConfig( $config );
60 }
61
62 }