diff --git a/conditional_fields.module b/conditional_fields.module index 975924f..ce6325b 100644 --- a/conditional_fields.module +++ b/conditional_fields.module @@ -1156,17 +1156,24 @@ function conditional_fields_evaluate_dependency($context, $values, $options) { if(is_null(current($values))) { return FALSE; } - - $key = current(array_keys((array) current($values))); - $dependency_values = array(array($key => $options['value'][0][$key])); - $temp[][$key] = $values[0][$key]; - $values = $temp; + + if (count($options['value'])) { + $key = current(array_keys((array) current($values))); + $dependency_values = array(array($key => $options['value'][0][$key])); + $temp[][$key] = $values[0][$key]; + $values = $temp; + } } // Compare arrays recursively ignoring keys, since multiple select widgets // values have numeric keys in form format and string keys in storage // format. - return array_values($dependency_values) == array_values($values); + if (is_array($dependency_values)) { + return array_values($dependency_values) == array_values($values); + } + else { + return $dependency_values == array_values($values); + } } // $values, when viewing fields, may contain all sort of additional