drexlerux / yii2-lcswitch
LC Switch extension for Yii2
Package info
github.com/drexlerux/yii2-lcswitch
Type:yii2-extension
pkg:composer/drexlerux/yii2-lcswitch
1.1.0
2017-09-06 23:00 UTC
Requires
- php: >=5.6.0
- bower-asset/lc-switch: *
- yiisoft/yii2: ~2.0.0
This package is not auto-updated.
Last update: 2026-03-01 11:51:56 UTC
README
LC Switch extension for Yii2
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist drexlerux/yii2-lcswitch "*"
or add
"drexlerux/yii2-lcswitch": "*"
to the require section of your composer.json file.
Usage
- Namespace to use widget class
use drexlerux\lcswitch\LcSwitch;
- Once the extension is installed, simply use it in your code by :
<?= $form->field($model, 'attribute')->widget(LcSwitch::classname(), [ 'options'=>[ 'on_text' => Yii::t('app', 'Yes'), // Default value 'of_text' => Yii::t('app', 'No'), // Default value 'width' => '100px' ], 'events' => [ 'lcs-init' => "function(input){}" 'lcs-statuschange' => 'function(){}', 'lcs-on' => 'function(){}', 'lcs-off' => 'function(){}', ] ]); ?>