All Projects → 2amigos → yii2-switch-widget

2amigos / yii2-switch-widget

Licence: other
Bootstrap Switch Widget for Yii2

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to yii2-switch-widget

yii2-multi-select-widget
Bootstrap MultiSelect and MultiSelect Listbox widgets for Yii2
Stars: ✭ 45 (+164.71%)
Mutual labels:  widget, yii2, 2amigos
yii2-grid-view-library
Highly enhanced GridView widget and grid components for Yii2
Stars: ✭ 57 (+235.29%)
Mutual labels:  widget, yii2, 2amigos
yii2-time-down-counter
Widget for yii2, to start count down timer with a lot of options, This widget build dependence of timeDownCounter JS library
Stars: ✭ 15 (-11.76%)
Mutual labels:  widget, yii2
yii2-notification-wrapper
Yii2-notification-wrapper module renders a message from session flash (with ajax, pjax support and etc.) through Growl, Noty, Toastr and more libraries
Stars: ✭ 78 (+358.82%)
Mutual labels:  widget, yii2
Yii2 Fullcalendar
Widget for Yii Framework 2.0 to use FullCalendar
Stars: ✭ 5 (-70.59%)
Mutual labels:  widget, yii2
yii2-highcharts-widget
HighCharts Js Widget for Yii2
Stars: ✭ 40 (+135.29%)
Mutual labels:  widget, yii2
yii2-cookiemonster
Yii extension to manage cookie warning
Stars: ✭ 16 (-5.88%)
Mutual labels:  widget, yii2
yii2-number
A number format mask control and input for Yii2 Framework
Stars: ✭ 22 (+29.41%)
Mutual labels:  widget, yii2
Yii2 Quill
Yii 2 implementation of Quill, modern WYSIWYG editor
Stars: ✭ 52 (+205.88%)
Mutual labels:  widget, yii2
Yii2 Sortable Widgets
🍨 Rubaxa/Sortable for Yii2
Stars: ✭ 54 (+217.65%)
Mutual labels:  widget, yii2
Yii2 Date Picker Widget
Bootstrap DatePicker Widget for Yii2
Stars: ✭ 128 (+652.94%)
Mutual labels:  widget, yii2
yii2-widget-cropbox
This widget allows crop image before upload to server and send informations about crop in JSON format.
Stars: ✭ 90 (+429.41%)
Mutual labels:  widget, yii2
yii2-selectize-widget
Selectize From Brian Reavis Yii2 Widget
Stars: ✭ 73 (+329.41%)
Mutual labels:  widget, 2amigos
yii2-google-analytics
Google Analytics Universal tracking widget.
Stars: ✭ 14 (-17.65%)
Mutual labels:  widget, yii2
yii2-datetime-widgets
Datetime widgets for Yii2
Stars: ✭ 22 (+29.41%)
Mutual labels:  widget, yii2
yii2-content-tools
ContentTools editor implementation for Yii 2
Stars: ✭ 79 (+364.71%)
Mutual labels:  widget, yii2
yii2-flysystem-component
The League Flysystem Library for Yii Framework
Stars: ✭ 22 (+29.41%)
Mutual labels:  yii2, 2amigos
Yii2 Fotorama Widget
Fotorama image gallery widget for yii2
Stars: ✭ 18 (+5.88%)
Mutual labels:  widget, yii2
Yii2 Imperavi Widget
Imperavi Redactor widget for Yii 2
Stars: ✭ 250 (+1370.59%)
Mutual labels:  widget, yii2
yii2-config-kit
Configuration kit for Yii applications
Stars: ✭ 24 (+41.18%)
Mutual labels:  yii2, 2amigos

Bootstrap Switch Widget for Yii2

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

Renders a Bootstrap Toggle Switch plugin widget.

Installation

The preferred way to install this extension is through composer.

Either run

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

or add

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

to the require section of your composer.json file.

Usage

The widget comes in two flavors:

  • SwitchBox
  • SwitchRadio

SwitchBox

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.

Example of use with a form

<?php
use dosamigos\switchinput\SwitchBox;
?>

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

Example of use without a model

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

SwitchRadio

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

Example of use with a form

<?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

<?= \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

<?= $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.

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

Testing

$ ./vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details.

Credits

License

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


Custom Software | Web & Mobile Software Development
www.2amigos.us
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].