function mailchimp_lists_field_validate in Mailchimp 7.4
Same name and namespace in other branches
- 7.5 modules/mailchimp_lists/includes/mailchimp_lists.field.inc \mailchimp_lists_field_validate()
- 7.3 modules/mailchimp_lists/includes/mailchimp_lists.field.inc \mailchimp_lists_field_validate()
Implements hook_field_validate().
File
- modules/
mailchimp_lists/ includes/ mailchimp_lists.field.inc, line 292 - Field hooks.
Code
function mailchimp_lists_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors) {
if ($instance['required'] && $entity !== NULL) {
foreach ($items as $delta => $item) {
if (!$item['subscribe']) {
$errors[$field['field_name']][$langcode][$delta][] = array(
'error' => 'mailchimp_lists_required',
'message' => t('Subscription to Mailchimp List %name is required.', array(
'%name' => $instance['label'],
)),
);
return FALSE;
}
}
}
return TRUE;
}