function countries_country_field_validate in Countries 7
We need to transform the field values here to complete the requirements for the field custom handling of multiple values.
This converts the array('AU' => 'AU', 'US' => 'US') to array(0 => array('iso2' => 'AU'), 1 => array('iso2' => 'US')).
See also
countries_country_element_validate() for validation.
1 string reference to 'countries_country_field_validate'
- countries_field_widget_form in ./
countries.module - Implements hook_field_widget_form().
File
- ./
countries.module, line 581
Code
function countries_country_field_validate($element, &$form_state) {
$values = array();
if (!is_array($element['#value'])) {
$element['#value'] = array_filter(array(
$element['#value'],
));
}
foreach (array_values($element['#value']) as $value) {
$values[] = array(
'iso2' => $value,
);
}
form_set_value($element, $values, $form_state);
}