You are here

function domain_theme_init in Domain Access 6.2

Implement hook_init()

File

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

Code

function domain_theme_init() {

  // Assign the theme selected, based on the active domain.
  global $_domain, $custom_theme;

  // If the theme has already been set (such as an admin theme), only load settings.
  if (empty($custom_theme)) {
    $theme = domain_theme_lookup($_domain['domain_id']);
  }
  else {
    $theme = domain_theme_lookup($_domain['domain_id'], $custom_theme);
  }

  // The above returns -1 on failure.
  if ($theme != -1) {

    // Set our domain-specific theme.
    if (empty($custom_theme)) {
      $custom_theme = $theme['theme'];
    }
    domain_theme_set_variables($theme);
  }
}