phpNT - Yii2 ICheck
, (*1)
Описание:
Стилизованный чекбоксы и радиокнопки.
Социальные сети:
Установка:, (*2)
php composer.phar require "phpnt/yii2-icheck" "*"
или, (*3)
composer require phpnt/yii2-icheck
или добавить в composer.json файл, (*4)
"phpnt/yii2-icheck": "*"
### Представление:
use phpnt\ICheck\ICheck;
STYLE_MIMIMAL (цвета для STYLE_MIMIMAL - minimal (черный), red, green, blue, aero, grey, orange, yellow, pink, purple)
= $form->field($model, 'checkbox', ['template' => '{label} {input}'])->widget(ICheck::className(), [
'type' => ICheck::TYPE_CHECBOX,
'style' => ICheck::STYLE_MIMIMAL,
'color' => 'green' // цвет
]) ?>
= $form->field($model, 'checkbox2')->widget(ICheck::className(), [
'type' => ICheck::TYPE_CHECBOX_LIST,
'style' => ICheck::STYLE_MIMIMAL,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'color' => 'minimal', // цвет
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return '
';
}
]]) ?>
= $form->field($model, 'checkbox3')->widget(ICheck::className(), [
'type' => ICheck::TYPE_CHECBOX_LIST,
'style' => ICheck::STYLE_MIMIMAL,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'color' => 'red', // цвет
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return ' ';
}
]]) ?>
= $form->field($model, 'radio')->widget(ICheck::className(), [
'type' => ICheck::TYPE_RADIO,
'style' => ICheck::STYLE_MIMIMAL,
'color' => 'green' // цвет
]) ?>
= $form->field($model, 'radio2')->widget(ICheck::className(), [
'type' => ICheck::TYPE_RADIO_LIST,
'style' => ICheck::STYLE_MIMIMAL,
'items' => [1 => 'Вася2', 2 => 'Катя2', 3 => 'Жора'],
'color' => 'purple', // цвет
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return '
';
}
]]) ?>
= $form->field($model, 'radio3')->widget(ICheck::className(), [
'type' => ICheck::TYPE_RADIO_LIST,
'style' => ICheck::STYLE_MIMIMAL,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'color' => 'blue', // цвет
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return ' ';
}
]]) ?>
STYLE_SQUARE (цвета для STYLE_SQUARE - square (черный), red, green, blue, aero, grey, orange, yellow, pink, purple)
= $form->field($model, 'checkbox4', ['template' => '{label} {input}'])->widget(ICheck::className(), [
'type' => ICheck::TYPE_CHECBOX,
'style' => ICheck::STYLE_SQUARE,
'color' => 'square' // цвет
]) ?>
= $form->field($model, 'checkbox5')->widget(ICheck::className(), [
'type' => ICheck::TYPE_CHECBOX_LIST,
'style' => ICheck::STYLE_SQUARE,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'color' => 'green', // цвет
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return ' ';
}
]]) ?>
= $form->field($model, 'checkbox6')->widget(ICheck::className(), [
'type' => ICheck::TYPE_CHECBOX_LIST,
'style' => ICheck::STYLE_SQUARE,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'color' => 'red', // цвет
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return '
';
}
]]) ?>
= $form->field($model, 'radio4')->widget(ICheck::className(), [
'type' => ICheck::TYPE_RADIO,
'style' => ICheck::STYLE_SQUARE,
'color' => 'blue' // цвет
]) ?>
= $form->field($model, 'radio5')->widget(ICheck::className(), [
'type' => ICheck::TYPE_RADIO_LIST,
'style' => ICheck::STYLE_SQUARE,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'color' => 'yellow', // цвет
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return '
';
}
]]) ?>
= $form->field($model, 'radio6')->widget(ICheck::className(), [
'type' => ICheck::TYPE_RADIO_LIST,
'style' => ICheck::STYLE_SQUARE,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'color' => 'aero', // цвет
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return ' ';
}
]]) ?>
STYLE_FLAT (цвета для STYLE_SQUARE - flat (черный), red, green, blue, aero, grey, orange, yellow, pink, purple)
= $form->field($model, 'checkbox7', ['template' => '{label} {input}'])->widget(ICheck::className(), [
'type' => ICheck::TYPE_CHECBOX,
'style' => ICheck::STYLE_FLAT,
'color' => 'flat' // цвет
]) ?>
= $form->field($model, 'checkbox8')->widget(ICheck::className(), [
'type' => ICheck::TYPE_CHECBOX_LIST,
'style' => ICheck::STYLE_FLAT,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'color' => 'green', // цвет
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return ' ';
}
]]) ?>
= $form->field($model, 'checkbox9')->widget(ICheck::className(), [
'type' => ICheck::TYPE_CHECBOX_LIST,
'style' => ICheck::STYLE_FLAT,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'color' => 'red', // цвет
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return '
';
}
]]) ?>
= $form->field($model, 'radio7')->widget(ICheck::className(), [
'type' => ICheck::TYPE_RADIO,
'style' => ICheck::STYLE_FLAT,
'color' => 'blue' // цвет
]) ?>
= $form->field($model, 'radio8')->widget(ICheck::className(), [
'type' => ICheck::TYPE_RADIO_LIST,
'style' => ICheck::STYLE_FLAT,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'color' => 'yellow', // цвет
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return '
';
}
]]) ?>
= $form->field($model, 'radio9')->widget(ICheck::className(), [
'type' => ICheck::TYPE_RADIO_LIST,
'style' => ICheck::STYLE_FLAT,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'color' => 'aero', // цвет
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return ' ';
}
]]) ?>
STYLE_LINE (цвета для STYLE_LINE - line (черный), red, green, blue, aero, grey, orange, yellow, pink, purple)
= $form->field($model, 'checkbox10')->widget(ICheck::className(), [
'type' => ICheck::TYPE_CHECBOX_LIST,
'style' => ICheck::STYLE_LINE,
'items' => [1 => 'Вася'],
'color' => 'yellow', // цвет
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return '
';
},
]]) ?>
= $form->field($model, 'checkbox11')->widget(ICheck::className(), [
'type' => ICheck::TYPE_CHECBOX_LIST,
'style' => ICheck::STYLE_LINE,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'color' => 'red', // цвет
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return '
';
},
]]) ?>
= $form->field($model, 'radio10')->widget(ICheck::className(), [
'type' => ICheck::TYPE_RADIO_LIST,
'style' => ICheck::STYLE_LINE,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'color' => 'pink', // цвет
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return '
';
},
]]) ?>
STYLE_POLARIS
= $form->field($model, 'checkbox12', ['template' => '{label} {input}'])->widget(ICheck::className(), [
'type' => ICheck::TYPE_CHECBOX,
'style' => ICheck::STYLE_POLARIS,
]) ?>
= $form->field($model, 'checkbox13')->widget(ICheck::className(), [
'type' => ICheck::TYPE_CHECBOX_LIST,
'style' => ICheck::STYLE_POLARIS,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return ' ';
}
]]) ?>
= $form->field($model, 'checkbox14')->widget(ICheck::className(), [
'type' => ICheck::TYPE_CHECBOX_LIST,
'style' => ICheck::STYLE_POLARIS,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return '
';
}
]]) ?>
= $form->field($model, 'radio11')->widget(ICheck::className(), [
'type' => ICheck::TYPE_RADIO,
'style' => ICheck::STYLE_POLARIS,
]) ?>
= $form->field($model, 'radio12')->widget(ICheck::className(), [
'type' => ICheck::TYPE_RADIO_LIST,
'style' => ICheck::STYLE_POLARIS,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return '
';
}
]]) ?>
= $form->field($model, 'radio13')->widget(ICheck::className(), [
'type' => ICheck::TYPE_RADIO_LIST,
'style' => ICheck::STYLE_POLARIS,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return ' ';
}
]]) ?>
STYLE_FUTURICO
= $form->field($model, 'checkbox15', ['template' => '{label} {input}'])->widget(ICheck::className(), [
'type' => ICheck::TYPE_CHECBOX,
'style' => ICheck::STYLE_FUTURICO,
]) ?>
= $form->field($model, 'checkbox16')->widget(ICheck::className(), [
'type' => ICheck::TYPE_CHECBOX_LIST,
'style' => ICheck::STYLE_FUTURICO,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return ' ';
}
]]) ?>
= $form->field($model, 'checkbox17')->widget(ICheck::className(), [
'type' => ICheck::TYPE_CHECBOX_LIST,
'style' => ICheck::STYLE_FUTURICO,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return '
';
}
]]) ?>
= $form->field($model, 'radio14')->widget(ICheck::className(), [
'type' => ICheck::TYPE_RADIO,
'style' => ICheck::STYLE_FUTURICO,
]) ?>
= $form->field($model, 'radio15')->widget(ICheck::className(), [
'type' => ICheck::TYPE_RADIO_LIST,
'style' => ICheck::STYLE_FUTURICO,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return '
';
}
]]) ?>
= $form->field($model, 'radio16')->widget(ICheck::className(), [
'type' => ICheck::TYPE_RADIO_LIST,
'style' => ICheck::STYLE_FUTURICO,
'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'],
'options' => [
'item' => function ($index, $label, $name, $checked, $value){
return ' ';
}
]]) ?>
Документация:
Лицензия: