loveorigami/yii2-bootstrap-toggle

Yii2 bootstrap-toggle widget

Installs: 136 396

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 3

Forks: 9

Open Issues: 0

Type:yii2-extension

1.1 2016-05-12 15:57 UTC

This package is auto-updated.

Last update: 2024-10-21 20:31:17 UTC


README

This extension provides the Bootstrap-toggle integration for the Yii2 framework.

Installation

This extension requires Bootstrap-toggle

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist loveorigami/yii2-bootstrap-toggle "*"

or add

"loveorigami/yii2-bootstrap-toggle": "*"

to the require section of your composer.json.

General Usage

use lo\widgets\Toggle;

Toggle::widget(
    [
        'name' => 'status', // input name. Either 'name', or 'model' and 'attribute' properties must be specified.
        'checked' => true,
        'options' => [], // checkbox options. More data html options [see here](http://www.bootstraptoggle.com)
    ]
)

or with active form as

    <?= $form->field($model, 'status')->widget(Toggle::className(),
		[
			'options' =>[
				'id' => 'my-id',
			]
		]
	); ?>