You are here

function field_example_field_widget_error in Examples for Developers 7

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

field_example/field_example.module, line 355
An example field using the Field Types API.

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;
  }
}