/** * Override or insert variables into the html template. * * @param $variables * An array of variables to pass to the theme template. * @param $hook * The name of the template being rendered. This is usually "html", but can * also be "maintenance_page" since zen_preprocess_maintenance_page() calls * this function to have consistent variables. */ function zen_preprocess_html(&$variables, $hook) { // If the user is silly and enables Zen as the theme, add some styles. if ($GLOBALS['theme'] == 'zen') { include_once './' . drupal_get_path('theme', 'zen') . '/zen-internals/template.zen.inc'; _zen_preprocess_html($variables, $hook); } elseif (!module_exists('conditional_styles')) { zen_add_conditional_styles(); } drupal_add_js(path_to_theme() . '/js/vendor/angular/angular.min.js', array('group' => JS_THEME)); drupal_add_js(path_to_theme() . '/js/vendor/angular/angular-sanitize.min.js', array('group' => JS_THEME)); drupal_add_js(path_to_theme() . '/js/vendor/angular/angular-resource.min.js', array('group' => JS_THEME)); drupal_add_js(path_to_theme() . '/js/vendor/angular/angular-route.min.js', array('group' => JS_THEME)); drupal_add_js(path_to_theme() . '/js/app.js', array('group' => JS_THEME)); $variables['jump_link_target'] = check_plain(theme_get_setting('zen_jump_link_target')); $variables['jump_link_text'] = check_plain(theme_get_setting('zen_jump_link_text')); // Return early, so the maintenance page does not call any of the code below. if ($hook != 'html') { return; } // Classes for body element. Allows advanced theming based on context // (home page, node of certain type, etc.) if (!$variables['is_front']) { // Add unique class for each page. $path = drupal_get_path_alias($_GET['q']); // Add unique class for each website section. list($section, ) = explode('/', $path, 2); $arg = explode('/', $_GET['q']); if ($arg[0] == 'node' && isset($arg[1])) { if ($arg[1] == 'add') { $section = 'node-add'; } elseif (isset($arg[2]) && is_numeric($arg[1]) && ($arg[2] == 'edit' || $arg[2] == 'delete')) { $section = 'node-' . $arg[2]; } } $variables['classes_array'][] = drupal_html_class('section-' . $section); } if (theme_get_setting('zen_wireframes')) { $variables['classes_array'][] = 'with-wireframes'; // Optionally add the wireframes style. } // Store the menu item since it has some useful information. $variables['menu_item'] = menu_get_item(); if ($variables['menu_item']) { switch ($variables['menu_item']['page_callback']) { case 'views_page': // Is this a Views page? $variables['classes_array'][] = 'page-views'; break; case 'page_manager_page_execute': case 'page_manager_node_view': case 'page_manager_contact_site': // Is this a Panels page? $variables['classes_array'][] = 'page-panels'; break; } } }
/** * Override or insert variables into the maintenance page template. * * @param $variables * An array of variables to pass to the theme template. * @param $hook * The name of the template being rendered ("maintenance_page" in this case.) */ function zen_preprocess_maintenance_page(&$variables, $hook) { // If Zen is the maintenance theme, add some styles. if ($GLOBALS['theme'] == 'zen') { include_once './' . drupal_get_path('theme', 'zen') . '/zen-internals/template.zen.inc'; _zen_preprocess_html($variables, $hook); } elseif (!module_exists('conditional_styles')) { zen_add_conditional_styles(); } }