2017 © Pedro Peláez
 

yii2-extension yii2-widget-switchery

Enhanced Yii2 wrapper for the Switchery.js plugin.

image

toxor88/yii2-widget-switchery

Enhanced Yii2 wrapper for the Switchery.js plugin.

  • Thursday, October 27, 2016
  • by toxor88
  • Repository
  • 3 Watchers
  • 4 Stars
  • 6,929 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 2 Versions
  • 6 % Grown

The README.md

yii2-widget-switchery

Latest Stable Version License Total Downloads Monthly Downloads Daily Downloads, (*1)

iOS Switchery Slider (http://abpetkov.github.io/switchery/), (*2)

Installation

The preferred way to install this extension is through composer. Check the composer.json for this extension's requirements and dependencies., (*3)

To install, either run, (*4)

$ php composer.phar require toxor88/yii2-widget-switchery "*"

or add, (*5)

"toxor88/yii2-widget-switchery": "*"

to the require section of your composer.json file., (*6)

Demo

You can refer detailed documentation and demos on usage of the extension., (*7)

Usage

use toxor88\switchery\Switchery;
use yii\web\JsExpression;

// usage without model
echo '<label>Can do something?</label>';
echo Switchery::widget([
    'name' => 'can_do_something', 
    'clientOptions' => [
        'color'              => '#64bd63',
        'secondaryColor'     => '#dfdfdf',
        'jackColor'          => '#fff',
        'jackSecondaryColor' => null,
        'className'          => 'switchery',
        'disabled'           => false,
        'disabledOpacity'    => 0.5,
        'speed'              => '0.1s',
        'size'               => 'default',
    ],
    'clientChangeEvent' => new JsExpression('function() {
        alert("checked: " + this.checked);
    }'),
]);

// usage with model
$form->model($model, 'attribute')->widget(Switchery::className(), [ /* widget options... */ ]);

// if you use the defualt ActiveField template, there can be multiple labels. To avoid it use:
// the label displays after the slider:
$form->model($model, 'attribute')->widget(Switchery::className(), [ /* widget options... */ ])->label(false);

// the label displays before the slider:
$form->model($model, 'attribute')->widget(Switchery::className(), [ 'options' => 'label' => null ])->label('label text or inherited from model');

License

yii2-widget-switchery is released under the BSD 3-Clause License. See the bundled LICENSE for details., (*8)

The Versions

27/10 2016

dev-master

9999999-dev https://github.com/toxor88/yii2-widget-switchery

Enhanced Yii2 wrapper for the Switchery.js plugin.

  Sources   Download

BSD 3-Clause

The Requires

 

by Steven Cash

plugin extension yii2 jquery form widget checkbox switchery

19/05 2015

1.0

1.0.0.0 https://github.com/toxor88/yii2-widget-switchery

Enhanced Yii2 wrapper for the Switchery.js plugin.

  Sources   Download

BSD 3-Clause

The Requires

 

by Steven Cash

plugin extension yii2 jquery form widget checkbox switchery