function gdpr_consent_field_validate in General Data Protection Regulation 7
Implements hook_field_validate().
File
- modules/
gdpr_consent/ gdpr_consent.module, line 390 - Contains hook implementations and shared functions.
Code
function gdpr_consent_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors) {
$valid = TRUE;
foreach ($items as $delta => $item) {
if (!empty($item['target_id'])) {
if (!$valid) {
$errors[$field['field_name']][$langcode][$delta][] = array(
'error' => 'gdpr_user_consent_invalid',
'message' => t('Referenced consent agreement entity is invalid.'),
);
}
}
}
}