diff --git a/Civi/FormProcessor/Type/OptionGroupType.php b/Civi/FormProcessor/Type/OptionGroupType.php index b236fcdb7ff482e541f5c8e3bd40b36bfee1e1d5..3b99accee5e2cc95050a9b0293612b0c145ad61d 100644 --- a/Civi/FormProcessor/Type/OptionGroupType.php +++ b/Civi/FormProcessor/Type/OptionGroupType.php @@ -100,6 +100,15 @@ class OptionGroupType extends AbstractType implements OptionListInterface { public function normalizeValue($value) { $this->loadOptions(); $multiple = $this->configuration->get('multiple') ? true : false; + + // Correct array values when field is not multiple. + // this could be caused for example by a drupal webform with + // a checkbox field. The value is submitted as an array, altough it contains + // only one value. + if (!$multiple && is_array($value) && count($value) == 1) { + $value = reset($value); + } + if ($multiple && is_array($value)) { $return = array(); foreach($value as $item) {