MediaWiki master
TitlesMultiselectWidget.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Widget;
4
12
14 protected $showMissing = null;
16 protected $namespace = null;
18 protected $relative = null;
20 protected $allowEditTags = null;
22 protected $creatable = null;
23
34 public function __construct( array $config = [] ) {
35 parent::__construct( $config );
36
37 // Properties
38 if ( isset( $config['showMissing'] ) ) {
39 $this->showMissing = $config['showMissing'];
40 }
41 if ( isset( $config['namespace'] ) ) {
42 $this->namespace = $config['namespace'];
43 }
44 if ( isset( $config['relative'] ) ) {
45 $this->relative = $config['relative'];
46 }
47 if ( isset( $config['allowEditTags'] ) ) {
48 $this->allowEditTags = $config['allowEditTags'];
49 }
50 if ( isset( $config['creatable'] ) ) {
51 $this->creatable = $config['creatable'];
52 }
53
54 $this->addClasses( [ 'mw-widgets-titlesMultiselectWidget' ] );
55 }
56
58 protected function getJavaScriptClassName() {
59 return 'mw.widgets.TitlesMultiselectWidget';
60 }
61
63 public function getConfig( &$config ) {
64 if ( $this->showMissing !== null ) {
65 $config['showMissing'] = $this->showMissing;
66 }
67 if ( $this->namespace !== null ) {
68 $config['namespace'] = $this->namespace;
69 }
70 if ( $this->relative !== null ) {
71 $config['relative'] = $this->relative;
72 }
73 if ( $this->allowEditTags !== null ) {
74 $config['allowEditTags'] = $this->allowEditTags;
75 }
76 if ( $this->creatable !== null ) {
77 $config['creatable'] = $this->creatable;
78 }
79
80 return parent::getConfig( $config );
81 }
82
83}
Base class for widgets to select multiple users, titles, namespaces, etc.