You are here

function domain_theme_menu in Domain Access 5

Same name and namespace in other branches
  1. 6.2 domain_theme/domain_theme.module \domain_theme_menu()
  2. 7.3 domain_theme/domain_theme.module \domain_theme_menu()
  3. 7.2 domain_theme/domain_theme.module \domain_theme_menu()

Implement hook_menu()

File

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

Code

function domain_theme_menu($may_cache) {
  $items = array();
  if (!$may_cache) {

    // Menu items for configuring themes.
    $items[] = array(
      'title' => t('Domain theme settings'),
      'path' => 'admin/build/domain/theme',
      'access' => user_access('administer domains'),
      'type' => MENU_CALLBACK,
      'callback' => 'domain_theme_page',
      'callback arguments' => array(
        arg(4),
      ),
    );
    $items[] = array(
      'title' => t('Domain site settings'),
      'path' => 'admin/build/domain/theme-reset',
      'access' => user_access('administer domains'),
      'type' => MENU_CALLBACK,
      'callback' => 'domain_theme_reset',
      'callback arguments' => array(
        arg(4),
      ),
    );
  }

  // Assign the theme selected, based on the active domain.
  global $_domain, $custom_theme;
  $default_theme = variable_get('theme_default', 'garland');
  $theme = domain_theme_lookup($_domain['domain_id']);

  // The above returns -1 on failure.
  if ($theme != -1) {
    if (arg(0) == 'admin') {
      $custom_theme = variable_get('admin_theme', '0');
    }
    else {
      $custom_theme = $theme['theme'];
    }
  }
  return $items;
}