You are here

function field_test_field_widget_error in Drupal 7

Implements hook_field_widget_error().

File

modules/field/tests/field_test.field.inc, line 227
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']);
}