Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
ToggleSwitchWidget | |
0.00% |
0 / 5 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
getJavaScriptClassName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Widget; |
4 | |
5 | use OOUI\CheckboxInputWidget; |
6 | |
7 | /** |
8 | * Base class for widgets to warp a checkbox into toggle widget. |
9 | * |
10 | * @copyright 2017 MediaWiki Widgets Team and others; see AUTHORS.txt |
11 | * @license MIT |
12 | */ |
13 | class ToggleSwitchWidget extends CheckboxInputWidget { |
14 | |
15 | public function __construct( array $config = [] ) { |
16 | parent::__construct( $config ); |
17 | |
18 | $this->setValue( $config['selected'] ); |
19 | $this->addClasses( [ 'mw-widgets-toggleSwitchWidget' ] ); |
20 | } |
21 | |
22 | protected function getJavaScriptClassName() { |
23 | return 'mw.widgets.ToggleSwitchWidget'; |
24 | } |
25 | } |