Commit cbb39d19 by Alexander Makarov

Merge pull request #1971 from klevron/1959

Fixes #1959 : compare model attribute with value/uncheck options
parents a2e0d2d0 f44605ff
...@@ -1162,8 +1162,13 @@ class BaseHtml ...@@ -1162,8 +1162,13 @@ class BaseHtml
{ {
$name = isset($options['name']) ? $options['name'] : static::getInputName($model, $attribute); $name = isset($options['name']) ? $options['name'] : static::getInputName($model, $attribute);
$checked = static::getAttributeValue($model, $attribute); $checked = static::getAttributeValue($model, $attribute);
if (array_key_exists('value', $options)) {
$checked = static::getAttributeValue($model, $attribute)===$options['value'];
}
if (!array_key_exists('uncheck', $options)) { if (!array_key_exists('uncheck', $options)) {
$options['uncheck'] = '0'; $options['uncheck'] = '0';
} elseif (static::getAttributeValue($model, $attribute)===$options['uncheck']) {
$checked = false;
} }
if (!array_key_exists('id', $options)) { if (!array_key_exists('id', $options)) {
$options['id'] = static::getInputId($model, $attribute); $options['id'] = static::getInputId($model, $attribute);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment