Better version of optgroup fix to still allow additional data (title, color) in option entries

This commit is contained in:
nathangray 2016-09-12 09:00:25 -06:00
parent 9cc9141422
commit 7afd7e420b

View File

@ -448,7 +448,7 @@ class Select extends Etemplate\Widget
{ {
if (is_array($val)) if (is_array($val))
{ {
if (isset($val['value']) && count($val) <= 2) if (isset($val['value']) && count(array_filter(array_keys($val), 'is_int')) == 0)
{ {
$values[] = $val['value']; $values[] = $val['value'];
} }
@ -471,7 +471,7 @@ class Select extends Etemplate\Widget
$values[] = $key; $values[] = $key;
} }
} }
//error_log(__METHOD__."('$name', TRUE) options=".array2string($options).' --> values='.array2string($values)); error_log(__METHOD__."('$name', TRUE) options=".array2string($options).' --> values='.array2string($values));
$options = $values; $options = $values;
} }
//error_log(__METHOD__."('$name') returning ".array2string($options)); //error_log(__METHOD__."('$name') returning ".array2string($options));