MediaWiki master
UserInputWidget.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Widget;
4
5use OOUI\TextInputWidget;
6
13class UserInputWidget extends TextInputWidget {
15 protected $excludeNamed;
16
18 protected $excludeTemp;
19
23 public function __construct( array $config = [] ) {
24 parent::__construct( $config );
25
26 if ( isset( $config['excludenamed'] ) ) {
27 $this->excludeNamed = $config['excludenamed'];
28 }
29
30 if ( isset( $config['excludetemp'] ) ) {
31 $this->excludeTemp = $config['excludetemp'];
32 }
33
34 // Initialization
35 $this->addClasses( [ 'mw-widget-userInputWidget' ] );
36 }
37
38 protected function getJavaScriptClassName() {
39 return 'mw.widgets.UserInputWidget';
40 }
41
42 public function getConfig( &$config ) {
43 $config['$overlay'] = true;
44
45 if ( $this->excludeNamed !== null ) {
46 $config['excludenamed'] = $this->excludeNamed;
47 }
48
49 if ( $this->excludeTemp !== null ) {
50 $config['excludetemp'] = $this->excludeTemp;
51 }
52
53 return parent::getConfig( $config );
54 }
55}