function _addressfield_autocomplete_widget_validate in Addressfield Autocomplete 7
Address autocomplete widget validation function.
Validate to see if lat and lng have been added for addresses which do not reveal the widget.
1 string reference to '_addressfield_autocomplete_widget_validate'
File
- ./
addressfield_autocomplete.module, line 577 - The Addressfield Autocomplete module code.
Code
function _addressfield_autocomplete_widget_validate($element, &$form_state, $form) {
$parents = $element['#parents'];
array_pop($parents);
$values = drupal_array_get_nested_value($form_state['values'], $parents);
if (!isset($values['data'])) {
return;
}
$data = unserialize($values['data']);
if (empty($data['latitude']) && empty($data['latitude'])) {
form_error($element, t('This address is invalid please try again.'));
}
}