You are here

function mailsystem_get_mail_theme in Mail System 7.2

Same name and namespace in other branches
  1. 8.4 mailsystem.module \mailsystem_get_mail_theme()
  2. 8.2 mailsystem.module \mailsystem_get_mail_theme()
  3. 6.2 mailsystem.module \mailsystem_get_mail_theme()
  4. 7.3 mailsystem.module \mailsystem_get_mail_theme()

Retrieves the key of the theme used to render the emails.

@todo Add some kind of hook to let other modules alter this behavior.

1 call to mailsystem_get_mail_theme()
mailsystem_theme_theme_registry_alter in ./mailsystem.theme.inc
Implements hook_theme_registry_alter().

File

./mailsystem.module, line 349
Provide UI for controlling the mail_system variable.

Code

function mailsystem_get_mail_theme() {
  global $theme_key;
  $theme = variable_get('mailsystem_theme', 'current');
  switch ($theme) {
    case 'default':
      $theme = variable_get('theme_default', NULL);
      break;
    case 'current':
      $theme = $theme_key;
      break;
    case 'domain':

      // Fetch the theme for the current domain.
      if (module_exists('domain_theme')) {

        // Assign the selected theme, based on the active domain.
        global $_domain;
        $domain_theme = domain_theme_lookup($_domain['domain_id']);

        // The above returns -1 on failure.
        $theme = $domain_theme != -1 ? $domain_theme['theme'] : $theme_key;
      }
      break;
  }
  return $theme;
}