You are here

function reroute_email_module_implements_alter in Reroute Email 7

Same name and namespace in other branches
  1. 8 reroute_email.module \reroute_email_module_implements_alter()
  2. 2.x reroute_email.module \reroute_email_module_implements_alter()

Implements hook_module_implements_alter().

Ensure reroute_email runs last when hook_mail_alter is invoked.

File

./reroute_email.module, line 21
Intercepts all outgoing emails to be rerouted to a configurable destination.

Code

function reroute_email_module_implements_alter(&$implementations, $hook) {

  // Testing with isset is only necessary if module doesn't implement the hook.
  if ($hook == 'mail_alter') {

    // Move our hook implementation to the bottom.
    $group = $implementations['reroute_email'];
    unset($implementations['reroute_email']);
    $implementations['reroute_email'] = $group;

    // If the queue_mail module is installed, ensure that comes after ours so
    // queued emails are still rerouted.
    if (isset($implementations['queue_mail'])) {
      $group = $implementations['queue_mail'];
      unset($implementations['queue_mail']);
      $implementations['queue_mail'] = $group;
    }
  }
}