MediaWiki master
ToggleSwitchWidget.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Widget;
4
5use OOUI\CheckboxInputWidget;
6
13class 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}
Base class for widgets to warp a checkbox into toggle widget.