diff --git a/forms/GroupedDropdownField.php b/forms/GroupedDropdownField.php index 018535ec2..18b622668 100755 --- a/forms/GroupedDropdownField.php +++ b/forms/GroupedDropdownField.php @@ -6,36 +6,48 @@ */ /** - * Grouped dropdown, using s. - * Returns a tag containing all the appropriate tags around the "; - foreach($title as $value2 => $title2) { - $selected = $value2 == $this->value ? " selected=\"selected\"" : ""; - $options .= "$title2"; - } - $options .= ""; - } else { // Fall back to the standard dropdown field - $selected = $value == $this->value ? " selected=\"selected\"" : ""; - $options .= "$title"; - } + if($this->source) { + foreach($this->source as $value => $title) { + if(is_array($title)) { + $options .= ""; + foreach($title as $value2 => $title2) { + $selected = $value2 == $this->value ? " selected=\"selected\"" : ""; + $options .= "$title2"; + } + $options .= ""; + } else { // Fall back to the standard dropdown field + $selected = $value == $this->value ? " selected=\"selected\"" : ""; + $options .= "$title"; + } + } } $id = $this->id(); return ""; - } + } } -?> + +?> \ No newline at end of file