Fix checkboxes using defaults not returning boolean

This commit is contained in:
Nathan Gray 2013-06-24 23:03:55 +00:00
parent 80ae80098e
commit a05ac6fa11

View File

@ -61,8 +61,8 @@ class etemplate_widget_checkbox extends etemplate_widget
// defaults for set and unset values // defaults for set and unset values
if (!$this->attrs['set_val'] && !$this->attrs['unset_val']) if (!$this->attrs['set_val'] && !$this->attrs['unset_val'])
{ {
$set_val = 'true'; $set_val = true;
$unset_val = 'false'; $unset_val = false;
} }
else else
{ {
@ -92,6 +92,11 @@ class etemplate_widget_checkbox extends etemplate_widget
{ {
if (!isset($valid)) $valid = array(); if (!isset($valid)) $valid = array();
} }
elseif ($value === 'true')
{
// 'true' != true
$valid = $set_val;
}
else else
{ {
$valid = $unset_val; $valid = $unset_val;