2017 © Pedro Peláez
 

yii2-extension yii2-switch-widget

The bootstrap switch widget for the Yii framework

image

2amigos/yii2-switch-widget

The bootstrap switch widget for the Yii framework

  • Wednesday, July 5, 2017
  • by tonydspaniard
  • Repository
  • 13 Watchers
  • 13 Stars
  • 17,120 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 13 Forks
  • 1 Open issues
  • 7 Versions
  • 11 % Grown

The README.md

Bootstrap Switch Widget for Yii2

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads, (*1)

Renders a Bootstrap Toggle Switch plugin widget., (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

$ composer require 2amigos/yii2-switch-widget:~1.0

or add, (*5)

"2amigos/yii2-switch-widget": "~1.0"

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

Usage

The widget comes in two flavors:, (*7)

  • SwitchBox
  • SwitchRadio

SwitchBox, (*8)

This widget renders a Bootstrap Toggle Switch Checkbox input control. Best suitable for attributes with boolean states (on|off, true|false, 1|0) when used with model., (*9)

Example of use with a form, (*10)



= $form->field($model, 'validated')->widget(SwitchBox::className(),[
    'clientOptions' => [
        'size' => 'large',
        'onColor' => 'success',
        'offColor' => 'danger'
    ]
]);?>

Example of use without a model, (*11)

<?= \dosamigos\switchinput\SwitchBox::widget([
    'name' => 'Test',
    'checked' => true,
    'clientOptions' => [
        'size' => 'large',
        'onColor' => 'success',
        'offColor' => 'danger'
    ]
]);?>

SwitchRadio, (*12)

This widget renders a Bootstrap Toggle Switch Checkbox radio list control. Best suitable for attributes with multiple states when used with a model., (*13)

Example of use with a form, (*14)

<?php
use dosamigos\switchinput\SwitchRadio;
?>
<?= $form->field($model, 'status')->widget(SwitchRadio::className(), [
    'items' => [
        20 => 'rejected',
        40 => 'approved',
        50 => 'on hold'
    ],
]);?>

Example of use without a model, (*15)

<?= \dosamigos\switchinput\SwitchRadio::widget([
    'name' => 'shape',
    'inline' => false,
    'items' => [
        [
            'label' => 'best',
            'value' => 100,
            'options' => ['data-size' => 'mini']
        ],
        20 => 'good',
        40 => 'superior',
        50 => 'master'
    ],
    'labelOptions' => ['style' => 'font-size:16px']
]);?>

Not displaying the label, (*16)

<?= $form->field($model, 'validated')->widget(SwitchBox::className(),[
    'options' => [
        'label' => false
    ],
    'clientOptions' => [
        'size' => 'large',
        'onColor' => 'success',
        'offColor' => 'danger'
    ]
]);?>

Using code fixer

We have added a PHP code fixer to standardize our code. It includes Symfony, PSR2 and some contributors rules., (*17)

./vendor/bin/php-cs-fixer fix ./src --config .php_cs

Testing

$ ./vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details., (*18)

Credits

License

The BSD License (BSD). Please see License File for more information., (*19)


Custom Software | Web & Mobile Software Development
www.2amigos.us

The Versions

05/07 2017

dev-master

9999999-dev https://github.com/2amigos/yii2-switch-widget

The bootstrap switch widget for the Yii framework

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Alexander Kochetov

yii2 2amigos yii yii 2 widget switch

05/07 2017

1.0.2

1.0.2.0 https://github.com/2amigos/yii2-switch-widget

The bootstrap switch widget for the Yii framework

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

yii2 2amigos yii yii 2 widget switch

05/07 2017

1.0.1

1.0.1.0 https://github.com/2amigos/yii2-switch-widget

The bootstrap switch widget for the Yii framework

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

yii2 2amigos yii yii 2 widget switch

20/03 2015

1.0.0

1.0.0.0 https://github.com/2amigos/yii2-selectize-widget

The bootstrap switch widget for the Yii framework

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Alexander Kochetov

yii2 2amigos yii yii 2 widget switch

20/03 2015

dev-develop

dev-develop https://github.com/2amigos/yii2-selectize-widget

The bootstrap switch widget for the Yii framework

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Alexander Kochetov

yii2 2amigos yii yii 2 widget switch

15/05 2014

0.1.1

0.1.1.0

Bootstrap Switch widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii widget switch

02/04 2014

0.1.0

0.1.0.0

Bootstrap Switch widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii widget switch