You are here

function feeds_test_field_field_validate in Feeds 7.2

Implements hook_field_validate().

File

tests/modules/feeds_test_field/feeds_test_field.module, line 39
Provides a field with special validation.

Code

function feeds_test_field_field_validate($obj_type, $object, $field, $instance, $langcode, $items, &$errors) {
  foreach ($items as $delta => $item) {

    // Verify that the current user has access to this field.
    if (!user_access('feeds_test_field.edit') && !user_access('administer feeds')) {
      $errors[$field['field_name']][$langcode][$delta][] = array(
        'error' => 'access_denied',
        // Since this module is only used in tests, the message doesn't have to
        // be translatable.
        'message' => 'You are not authorized to edit this field.',
      );
    }
  }
}