hook_field_widget_error

Versions
7
hook_field_widget_error($element, $error)

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.

Related topics

Code

modules/field/field.api.php, line 683

<?php
function hook_field_widget_error($element, $error) {
  form_error($element['value'], $error['message']);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.