Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
UserInputWidget | |
0.00% |
0 / 13 |
|
0.00% |
0 / 3 |
56 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
12 | |||
getJavaScriptClassName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getConfig | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
12 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Widget; |
4 | |
5 | use OOUI\TextInputWidget; |
6 | |
7 | /** |
8 | * User input widget. |
9 | * |
10 | * @copyright 2011-2015 MediaWiki Widgets Team and others; see AUTHORS.txt |
11 | * @license MIT |
12 | */ |
13 | class UserInputWidget extends TextInputWidget { |
14 | /** @var bool */ |
15 | protected $excludeNamed; |
16 | |
17 | /** @var bool */ |
18 | protected $excludeTemp; |
19 | |
20 | /** |
21 | * @param array $config Configuration options |
22 | */ |
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 | /** @inheritDoc */ |
39 | protected function getJavaScriptClassName() { |
40 | return 'mw.widgets.UserInputWidget'; |
41 | } |
42 | |
43 | /** @inheritDoc */ |
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 | } |