function field_test_field_widget_error

Implements hook_field_widget_error().

File

modules/field/tests/field_test.field.inc, line 227

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']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.