1 field_example.module field_example_field_widget_error($element, $error, $form, &$form_state)

Implements hook_field_widget_error().

hook_field_widget_error() lets us figure out what to do with errors we might have generated in hook_field_validate(). Generally, we'll just call form_error().

See also

field_example_field_validate()

form_error()

Related topics

File

modules/examples/field_example/field_example.module, line 357
Hook implementations for the Field Example module.

Code

function field_example_field_widget_error($element, $error, $form, &$form_state) {
  switch ($error['error']) {
    case 'field_example_invalid':
      form_error($element, $error['message']);
      break;
  }
}