hook_field_attach_validate

7 field.api.php hook_field_attach_validate($entity_type, $entity, &$errors)
8 field.api.php hook_field_attach_validate($entity_type, $entity, &$errors)

Act on field_attach_validate().

This hook is invoked after the field module has performed the operation.

See field_attach_validate() for details and arguments.

Related topics

1 invocation of hook_field_attach_validate()

File

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

Code

function hook_field_attach_validate($entity_type, $entity, &$errors) {
  // @todo Needs function body.
}

Comments

How to use $errors

FieldValidationException If validation errors are found, a FieldValidationException is thrown. The 'errors' property contains the array of errors, keyed by field name, language and delta.

Use it as in the example :

        $errors[$field_name]][$langcode][$delta][] = array(
          'error' => 'field_example_invalid',
          'message' => t('Color must be in the HTML format #abcdef.'),
        );

Login or register to post comments