|
|
|
@ -1161,15 +1161,14 @@ class BaseHtml
|
|
|
|
|
public static function activeCheckbox($model, $attribute, $options = []) |
|
|
|
|
{ |
|
|
|
|
$name = isset($options['name']) ? $options['name'] : static::getInputName($model, $attribute); |
|
|
|
|
$checked = static::getAttributeValue($model, $attribute); |
|
|
|
|
if (array_key_exists('value', $options)) { |
|
|
|
|
$checked = static::getAttributeValue($model, $attribute)===$options['value']; |
|
|
|
|
} |
|
|
|
|
$value = static::getAttributeValue($model, $attribute); |
|
|
|
|
|
|
|
|
|
if (!array_key_exists('uncheck', $options)) { |
|
|
|
|
$options['uncheck'] = '0'; |
|
|
|
|
} elseif (static::getAttributeValue($model, $attribute)===$options['uncheck']) { |
|
|
|
|
$checked = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$checked = ($value !== $options['uncheck']); |
|
|
|
|
|
|
|
|
|
if (!array_key_exists('id', $options)) { |
|
|
|
|
$options['id'] = static::getInputId($model, $attribute); |
|
|
|
|
} |
|
|
|
|