function mailchimp_activity_entity_form_validate in Mailchimp 7.2
Same name and namespace in other branches
- 7.5 modules/mailchimp_activity/includes/mailchimp_activity.admin.inc \mailchimp_activity_entity_form_validate()
- 7.3 modules/mailchimp_activity/includes/mailchimp_activity.admin.inc \mailchimp_activity_entity_form_validate()
- 7.4 modules/mailchimp_activity/includes/mailchimp_activity.admin.inc \mailchimp_activity_entity_form_validate()
Validation callback for mailchimp_activity_entity_form().
File
- modules/
mailchimp_activity/ mailchimp_activity.admin.inc, line 143 - Administration pages for mailchimp_campaign module.
Code
function mailchimp_activity_entity_form_validate($form, &$form_state) {
$extant_mc_entities = entity_load('mailchimp_activity_entity');
$form_id = $form_state['mailchimp_activity_entity']->mailchimp_activity_entity_id;
$form_bundle = $form_state['values']['bundle'];
$form_entity_id = $form_state['values']['entity_type'];
foreach ($extant_mc_entities as $extant_ent) {
if ($form_bundle == $extant_ent->bundle && $form_entity_id == $extant_ent->entity_type && $form_id != $extant_ent->mailchimp_activity_entity_id) {
form_set_error('bundle', t('A MailChimp Activity Entity already exists for this Bundle. Either select a different Bundle or edit the !link for this bundle.', array(
'!link' => l('existing MailChimp Activity Entity', "admin/config/services/mailchimp/activity/manage/{$extant_ent->name}"),
)));
}
}
}