From f44605fff0efde0300bffc1e63e619041df9f2f6 Mon Sep 17 00:00:00 2001 From: Kevin LEVRON <kevin.levron@univ-pau.fr> Date: Tue, 14 Jan 2014 16:31:50 +0100 Subject: [PATCH] Fixes #1959 : compare model attribute with value/uncheck options --- framework/helpers/BaseHtml.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/framework/helpers/BaseHtml.php b/framework/helpers/BaseHtml.php index 62a620d..8ebe542 100644 --- a/framework/helpers/BaseHtml.php +++ b/framework/helpers/BaseHtml.php @@ -1162,8 +1162,13 @@ class BaseHtml { $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']; + } if (!array_key_exists('uncheck', $options)) { $options['uncheck'] = '0'; + } elseif (static::getAttributeValue($model, $attribute)===$options['uncheck']) { + $checked = false; } if (!array_key_exists('id', $options)) { $options['id'] = static::getInputId($model, $attribute); -- libgit2 0.27.1