You are here

function workbench_email_module_implements_alter in Workbench Email 7.3

Same name and namespace in other branches
  1. 7 workbench_email.module \workbench_email_module_implements_alter()

Implments hook_module_implements_alter().

Make sure workbench_email form_alter fires after workbench_moderation form_alter.

File

./workbench_email.module, line 37
Code for the Workbench Email Module.

Code

function workbench_email_module_implements_alter(&$implementations, $hook) {
  if (strpos($hook, 'form') !== FALSE) {
    if (isset($implementations['workbench_moderation'], $implementations['workbench_email'])) {
      $workbench_email = $implementations['workbench_email'];
      unset($implementations['workbench_email']);
      $workbench_moderation = $implementations['workbench_moderation'];
      unset($implementations['workbench_moderation']);
      $implementations['workbench_moderation'] = $workbench_moderation;
      $implementations['workbench_email'] = $workbench_email;
    }
  }
  if ($hook == 'mail_alter') {

    // Ensure that our hook_mail_alter implementation is always called last.
    if (isset($implementations['workbench_email'])) {
      $group = $implementations['workbench_email'];
      unset($implementations['workbench_email']);

      // Now add it back, which will ensure we are called last.
      $implementations['workbench_email'] = $group;
    }
  }
}