dbfernandes / yii2-icomp-toggle
Installs: 86
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Type:yii2-extension
Requires
- bower-asset/bootstrap-toggle: ^2.2
- yiisoft/yii2: ^2.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-10-20 03:09:31 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' => [], ]);