function getlocations_fields_field_widget_error in Get Locations 7
Same name and namespace in other branches
- 7.2 modules/getlocations_fields/getlocations_fields.module \getlocations_fields_field_widget_error()
Implements hook_field_widget_error(). Flag a field-level validation error.
Parameters
$element: An array containing the form element for the widget. The error needs to be flagged on the right sub-element, according to the widget's internal structure.
$error: An associative array, as returned by getlocations_fields_field_validate().
$form: The form structure where field elements are attached to. This might be a full form structure, or a sub-element of a larger form.
$form_state: An associative array containing the current state of the form.
File
- modules/
getlocations_fields/ getlocations_fields.module, line 1664 - getlocations_fields.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function getlocations_fields_field_widget_error($element, $error, $form, &$form_state) {
switch ($error['error']) {
case 'latlon_empty':
unset($form_state['values'][$error['field_name']][$error['lang']][$error['delta']]);
break;
case 'field_required_name':
form_error($element['name'], $error['message']);
break;
case 'field_required_street':
form_error($element['street'], $error['message']);
break;
case 'field_required_additional':
form_error($element['additional'], $error['message']);
break;
case 'field_required_city':
form_error($element['city'], $error['message']);
break;
case 'field_required_province':
form_error($element['province'], $error['message']);
break;
case 'field_required_postal_code':
form_error($element['postal_code'], $error['message']);
break;
case 'field_required_country':
form_error($element['country'], $error['message']);
break;
case 'field_required_phone':
form_error($element['phone'], $error['message']);
break;
case 'field_required_mobile':
form_error($element['mobile'], $error['message']);
break;
case 'field_required_fax':
form_error($element['fax'], $error['message']);
break;
}
}