You are here

function mandrill_template_map_usage in Mandrill 7.2

Same name and namespace in other branches
  1. 8 modules/mandrill_template/mandrill_template.module \mandrill_template_map_usage()
  2. 7 modules/mandrill_template/mandrill_template.module \mandrill_template_map_usage()

Get all mailsystem keys pointed at mandrill and their template mappings.

Return value

array Returns an array with indexes matching each module which is assigned to use Mandrill for email sends, and values equal to the template_map_ids that are assigned to those modules. If no template maps are assigned, the value is set to NULL.

1 call to mandrill_template_map_usage()
mandrill_template_map_form in modules/mandrill_template/mandrill_template.admin.inc
Return a form for adding/editing a Mandrill template map.

File

modules/mandrill_template/mandrill_template.module, line 128
Enables Drupal to send email using Mandrill's template system.

Code

function mandrill_template_map_usage() {
  $system_assignments = mailsystem_get();

  // Filter out the systems that aren't using Mandrill:
  foreach ($system_assignments as $system => $assignment) {
    if ($assignment != 'MandrillMailSystem') {
      unset($system_assignments[$system]);
    }
    else {
      $system_assignments[$system] = NULL;
    }
  }
  $maps = mandrill_template_map_load_entities();
  foreach ($maps as $map) {
    if (isset($map->mailsystem_key) && array_key_exists($map->mailsystem_key, $system_assignments)) {
      $system_assignments[$map->mailsystem_key] = $map->mandrill_template_map_entity_id;
    }
  }
  uksort($system_assignments, '_mandrill_template_map_mailsystem_sort');
  return $system_assignments;
}