drexlerux/yii2-lcswitch

LC Switch extension for Yii2

Installs: 60

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:yii2-extension

1.1.0 2017-09-06 23:00 UTC

This package is not auto-updated.

Last update: 2024-09-15 04:20:55 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

  1. Namespace to use widget class
use drexlerux\lcswitch\LcSwitch;
  1. 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(){}',
    ]
]); ?>