1 field_test.field.inc field_test_field_widget_error($element, $error, $form, &$form_state)

Implements hook_field_widget_error().

File

core/modules/field/tests/field_test/field_test.field.inc, line 233
Defines a field type and its formatters and widgets.

Code

function field_test_field_widget_error($element, $error, $form, &$form_state) {
  // @todo No easy way to differenciate widget types, we should receive it as a
  // parameter.
  if (isset($element['value'])) {
    // Widget is test_field_widget.
    $error_element = $element['value'];
  }
  else {
    // Widget is test_field_widget_multiple.
    $error_element = $element;
  }

  form_error($error_element, $error['message']);
}