Renders a Bootstrap Toggle Switch plugin widget.
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist oakcms/yii2-bootstrap-switch "*"
or add
"oakcms/yii2-bootstrap-switch": "*"
to the require section of your composer.json
file.
Once the extension is installed, simply use it in your code by :
<?= $form->field($model, 'field')->widget(\oakcms\bootstrapswitch\Switcher::className()) ?>
Or
<?= \oakcms\bootstrapswitch\Switcher::widget([
'name' => 'Name',
'checked' => true,
'clientOptions' => [
'size' => 'large',
'onColor' => 'success',
'offColor' => 'danger'
]
]); ?>