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
39 protected function getJavaScriptClassName() {
40 return 'mw.widgets.UserInputWidget';
41 }
42
44 public function getConfig( &$config ) {
45 $config['$overlay'] = true;
46
47 if ( $this->excludeNamed !== null ) {
48 $config['excludenamed'] = $this->excludeNamed;
49 }
50
51 if ( $this->excludeTemp !== null ) {
52 $config['excludetemp'] = $this->excludeTemp;
53 }
54
55 return parent::getConfig( $config );
56 }
57}