array( 'file' => 'themekey_admin.inc', 'arguments' => array('form' => NULL), ), ); return $items; } /** * Implements hook_perm(). */ function themekey_perm() { return array('administer theme assignments', 'administer themekey settings'); } /** * Implements hook_menu(). */ function themekey_menu() { $items = array(); $items['admin/settings/themekey'] = array( 'title' => 'ThemeKey', 'description' => 'Map themes to Drupal paths or object properties.', 'access callback' => 'user_access', 'access arguments' => array('administer theme assignments'), 'file' => 'themekey_admin.inc', 'page callback' => 'drupal_get_form', 'page arguments' => array('themekey_rule_chain_form') ); $items['admin/settings/themekey/properties'] = array( 'title' => 'Theme Switching Rule Chain', 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => 0 ); $items['admin/settings/themekey/properties/delete'] = array( 'title' => 'Delete ThemeKey Property', 'page callback' => 'drupal_get_form', 'page arguments' => array('themekey_admin_delete_rule_confirm', 1), 'access callback' => 'user_access', 'access arguments' => array('administer theme assignments'), 'file' => 'themekey_admin.inc', 'type' => MENU_CALLBACK, ); $items['admin/settings/themekey/settings'] = array( 'title' => 'Settings', 'access callback' => 'user_access', 'access arguments' => array('administer themekey settings'), 'file' => 'themekey_admin.inc', 'page callback' => 'drupal_get_form', 'page arguments' => array('themekey_settings_form'), 'type' => MENU_LOCAL_TASK, 'weight' => 5 ); $items['admin/settings/themekey/settings/general'] = array( 'title' => 'General', 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => 0 ); return $items; } /** * Implements hook_themekey_properties(). */ function themekey_themekey_properties() { require_once(drupal_get_path('module', 'themekey') .'/themekey_build.inc'); return themekey_invoke_modules('themekey_properties'); } /** * Implements hook_themekey_global(). */ function themekey_themekey_global() { require_once(drupal_get_path('module', 'themekey') .'/themekey_build.inc'); return themekey_invoke_modules('themekey_global'); } /** * Implements hook_themekey_paths(). */ function themekey_themekey_paths() { require_once(drupal_get_path('module', 'themekey') .'/themekey_build.inc'); return themekey_invoke_modules('themekey_paths'); } /** * Implements hook_init(). * * Here happens all the magic of ThemeKey. * ThemeKey detects if any Theme Switching Rule matches * the current request and sets the global variable $custom_theme. */ function themekey_init() { global $custom_theme; // don't change theme when another module already set a $custom_theme like system.module does (administration theme) // don't change theme when administer blocks if (!$custom_theme && strpos($_GET['q'], 'admin/build/block') !== 0) { $theme = themekey_match_rules(); // If no theme has been triggered but a theme // is in the user's session, use that theme. if (!$theme && !empty($_SESSION['themekey_theme']) && (!$custom_theme || $custom_theme == variable_get('theme_default', 'garland'))) { $custom_theme = $_SESSION['themekey_theme']; } // We have a theme, apply it if (!empty($theme) && $theme != 'default') { if ((user_is_logged_in() && variable_get('themekey_theme_maintain', 0)) || (!user_is_logged_in() && variable_get('themekey_theme_maintain_anonymous', 0))) { $_SESSION['themekey_theme'] = $theme; } else { unset($_SESSION['themekey_theme']); } $custom_theme = $theme; } } } /** * Implements hook_themekey_load_validators(). */ function themekey_themekey_load_validators() { module_load_include('inc', 'themekey', 'themekey_validators'); } /** * Implements hook_help(). */ function themekey_help($path, $arg) { $text_1 = t('For every page request Drupal steps through this Theme Switching Rule Chain until an activated rule matches or it reaches the end. If a rule matches the theme associated to this rule will be applied to render the requested page.'); switch ($path) { case 'admin/help#themekey': module_load_include('inc', 'themekey', 'themekey_admin'); return '
' . t('ThemeKey allows you to define simple or sophisticated Theme Switching Rules. Using these rules you are able to use a different theme depending on current path, taxonomy terms, language, node type and many many more properties. It can also be easily extended to support additional properties as exposed by other modules.'). '
' . '' . $text_1 . '
'. drupal_get_form('themekey_help_form', FALSE); case 'admin/settings/themekey': module_load_include('inc', 'themekey', 'themekey_admin'); return '' . $text_1 . '
' . drupal_get_form('themekey_help_form', TRUE); } }