You are here

function domain_theme_custom_theme in Domain Access 7.3

Same name and namespace in other branches
  1. 7.2 domain_theme/domain_theme.module \domain_theme_custom_theme()

Implements hook_custom_theme().

File

domain_theme/domain_theme.module, line 21
Domain Theme module for the Domain Access module group.

Code

function domain_theme_custom_theme() {
  global $conf;
  $_domain = domain_get_domain();

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

  // Check for a custom admin theme.
  if (isset($conf['admin_theme']) && path_is_admin(current_path()) && user_access('view the administration theme')) {
    $theme = domain_theme_lookup($_domain['domain_id'], $conf['admin_theme']);

    // No custom settings, but use the admin theme.
    if ($theme == -1) {
      return $conf['admin_theme'];
    }
  }

  // The above returns -1 on failure.
  if ($theme != -1) {
    domain_theme_set_variables($theme);
    return $theme['theme'];
  }
}