You are here

function hook_field_widget_error in Drupal 7

Flag a field-level validation error.

Parameters

$element: An array containing the form element for the widget. The error needs to be flagged on the right sub-element, according to the widget's internal structure.

$error: An associative array with the following key-value pairs, as returned by hook_field_validate():

  • error: the error code. Complex widgets might need to report different errors to different form elements inside the widget.
  • message: the human readable message to be displayed.

$form: The form structure where field elements are attached to. This might be a full form structure, or a sub-element of a larger form.

$form_state: An associative array containing the current state of the form.

Related topics

5 functions implement hook_field_widget_error()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

field_test_field_widget_error in modules/field/tests/field_test.field.inc
Implements hook_field_widget_error().
number_field_widget_error in modules/field/modules/number/number.module
Implements hook_field_widget_error().
options_field_widget_error in modules/field/modules/options/options.module
Implements hook_field_widget_error().
taxonomy_field_widget_error in modules/taxonomy/taxonomy.module
Implements hook_field_widget_error().
text_field_widget_error in modules/field/modules/text/text.module
Implements hook_field_widget_error().

File

modules/field/field.api.php, line 1014
Hooks provided by the Field module.

Code

function hook_field_widget_error($element, $error, $form, &$form_state) {
  form_error($element, $error['message']);
}