"A little more refactoring on HtmlHelper::checkbox()"

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4226 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-12-28 07:31:24 +00:00
parent 90f6c38614
commit 9f48b1d28c

View file

@ -366,14 +366,14 @@ class HtmlHelper extends AppHelper {
$notCheckedValue = -1;
}
} else {
if (isset($htmlAttributes['value']) || (!class_exists($this->model()) && !loadModel($this->model()))) {
$model = $this->model();
if (isset($htmlAttributes['value']) || (!class_exists($model) && !loadModel($model))) {
$htmlAttributes['checked'] = ($htmlAttributes['value'] == $value) ? 'checked' : null;
if ($htmlAttributes['value'] == '0') {
$notCheckedValue = -1;
}
} else {
$model = $this->model();
$model = new $model;
$db =& ConnectionManager::getDataSource($model->useDbConfig);
$value = $db->boolean($value);