function field_example_field_widget_error

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

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