dbfernandes / yii2-icomp-toggle
Package info
github.com/dbfernandes/yii2-icomp-toggle
Type:yii2-extension
pkg:composer/dbfernandes/yii2-icomp-toggle
1.0.1
2017-07-14 08:19 UTC
Requires
- bower-asset/bootstrap-toggle: ^2.2
- yiisoft/yii2: ^2.0
Requires (Dev)
This package is auto-updated.
Last update: 2026-02-20 05:56:15 UTC
README
Yii2 extension to render bootstrap toggle widget instead of checkbox.
http://www.bootstraptoggle.com/
Installation
The preferred way to install this extension is through composer.
Either run
$ php composer.phar require dbfernandes/yii2-icomp-toggle dev-master
or add
"dbfernandes/yii2-icomp-toggle": "dev-master"
to the require section of your composer.json file.
Usage
In active form
use dbfernandes\icomp\ICompToggleWidget; //... echo $form->field($model, 'attribute')->widget(ICompToggleWidget::className()); //...
Standalone widget
use dbfernandes\icomp\ICompToggleWidget; //... IcompToggleWidget::widget([ 'name' => 'is_enabled', 'value' => false, ]); //...
Options
ICompToggleWidget::widget([ /** * Wrapper tag name. If set to false no tag will be rendered */ 'container' => 'div', /** * Wrapper HTML attributes */ 'containerOptions' => [], /** * Label when checkbox is checked */ 'labelEnabled' => 'Yes', /** * Label when checkbox is not checked */ 'labelDisabled' => 'No', /** * Additional javascript options to Bootstrap Toggle plugin */ 'pluginOptions' => [], ]);
