function mailchimp_automations_entity_automation in Mailchimp 7.4
Same name and namespace in other branches
- 7.5 modules/mailchimp_automations/mailchimp_automations.module \mailchimp_automations_entity_automation()
Queries to see if there is an existing automation entity
Parameters
string $type: The entity type name
string $bundle: The Drupal bundle for the entity
Return value
Object The mailchimp_automations_entity
1 call to mailchimp_automations_entity_automation()
- mailchimp_automations_entity_insert in modules/
mailchimp_automations/ mailchimp_automations.module - Implements hook_entity_insert().
File
- modules/
mailchimp_automations/ mailchimp_automations.module, line 200 - Module file for mailchimp_automations.
Code
function mailchimp_automations_entity_automation($type, $bundle) {
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'mailchimp_automations_entity')
->propertyCondition('entity_type', $type)
->propertyCondition('bundle', $bundle)
->propertyCondition('status', 1);
$result = $query
->execute();
if ($result) {
$entity_array = entity_load('mailchimp_automations_entity', array_keys($result['mailchimp_automations_entity']));
return reset($entity_array);
}
return NULL;
}