/** * Implements hook_preprocess(). */ function rogue_preprocess(&$variables) { // All panel templates will have access to the "is_panel_page" variable. if (isset($variables['layout']['plugin module']) && $variables['layout']['plugin module'] == 'panels') { $variables['is_panel_page'] = module_exists('page_manager') && page_manager_get_current_page(); } }
/** * * Implements template_prerocess_page(). */ function proud_base_preprocess_page(&$vars) { // If panels arent being used at all. $vars['no_panels'] = !(module_exists('page_manager') && page_manager_get_current_page()); $vars['copyright'] = ''; // Add select2 if (module_exists('libraries')) { $path = libraries_get_path('select2'); drupal_add_js($path . '/select2.min.js'); drupal_add_css($path . '/select2.css'); } }
/** * Override or insert variables into the page templates. * * @param $variables * An array of variables to pass to the theme template. * @param $hook * The name of the template being rendered ("page" in this case.) */ function mission_respondable_preprocess_page(&$variables, $hook) { // if this is a panel page, add template suggestions if ($panel_page = page_manager_get_current_page()) { // add a generic suggestion for all panel pages $variables['theme_hook_suggestions'][] = 'page__panel'; // add the panel page machine name to the template suggestions $variables['theme_hook_suggestions'][] = 'page__' . $panel_page['name']; //add a body class for good measure $body_classes[] = 'page-panel'; } }
/** * Preprocess HTML. */ function bootstrap_subtheme_preprocess_html(&$variables) { if (in_array('node-type-voice', $variables['classes_array'])) { $variables['classes_array'][] = 'individual-voice'; } if ($page_panel = page_manager_get_current_page()) { // Make sure CSS_ID defined in panels is attached to the page. if (!empty($page_panel['handler']->conf['css_id'])) { $css_id_array = array('id' => $page_panel['handler']->conf['css_id']); $variables['attributes_array'] = empty($variables['attributes_array']) ? $css_id_array : ($variables['attributes_array'] += $css_id_array); } } }
/** * Implements template_preprocess_page(). */ function radix_preprocess_page(&$variables) { global $base_url; // Add Bootstrap JS. $base = parse_url($base_url); drupal_add_js($base['scheme'] . '://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js', 'external'); // Add CSS for Font Awesome // drupal_add_css('//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css', 'external'); // Determine if the page is rendered using panels. $variables['is_panel'] = FALSE; if (module_exists('page_manager') && count(page_manager_get_current_page())) { $variables['is_panel'] = TRUE; } // Make sure tabs is empty. if (empty($variables['tabs']['#primary']) && empty($variables['tabs']['#secondary'])) { $variables['tabs'] = ''; } // Add search_form to theme. $variables['search_form'] = ''; if (module_exists('search') && user_access('search content')) { $search_box_form = drupal_get_form('search_form'); $search_box_form['basic']['keys']['#title'] = ''; $search_box_form['basic']['keys']['#attributes'] = array('placeholder' => 'Search'); $search_box_form['basic']['keys']['#attributes']['class'][] = 'search-query'; $search_box_form['basic']['submit']['#value'] = t('Search'); $search_box_form['#attributes']['class'][] = 'navbar-form'; $search_box_form['#attributes']['class'][] = 'pull-right'; $search_box = drupal_render($search_box_form); $variables['search_form'] = user_access('search content') ? $search_box : NULL; } // Format and add main menu to theme. $variables['main_menu'] = menu_tree(variable_get('menu_main_links_source', 'main-menu')); $variables['main_menu']['#theme_wrappers'] = array('menu_tree__primary'); // Add a copyright message. $variables['copyright'] = t('Drupal is a registered trademark of Dries Buytaert.'); // Display a message if Sass has not been compiled. $theme_path = drupal_get_path('theme', $GLOBALS['theme']); $stylesheet_path = $theme_path . '/assets/stylesheets/screen.css'; if (_radix_current_theme() == 'radix') { $stylesheet_path = $theme_path . '/assets/stylesheets/radix-style.css'; } if (!file_exists($stylesheet_path)) { drupal_set_message(t('It looks like %path has not been created yet. Run <code>@command</code> in your theme directory to create it.', array('%path' => $stylesheet_path, '@command' => 'compass watch')), 'error'); } }
function alfred_preprocess_page(&$vars, $hook) { //typekit //drupal_add_js('http://use.typekit.com/XXX.js', 'external'); //drupal_add_js('try{Typekit.load();}catch(e){}', array('type' => 'inline')); //webfont //drupal_add_css('http://cloud.webtype.com/css/CXXXX.css','external'); //googlefont // drupal_add_css('http://fonts.googleapis.com/css?family=Bree+Serif','external'); // If this is a panel page, add template suggestions. // Must have Ctools Page Manager enabled. Uncomment to use. if (module_exists('page_manager')) { if (isset($panel_page) && $panel_page === page_manager_get_current_page()) { // add a generic suggestion for all panel pages $vars['theme_hook_suggestions'][] = 'page__panel'; // add the panel page machine name to the template suggestions $vars['theme_hook_suggestions'][] = 'page__' . $panel_page['name']; //add a body class for good measure $body_classes[] = 'page-panel'; } } }
/** * Implements hook_preprocess_page(). */ function dguk_preprocess_page(&$variables) { // If this is a node view page add content type to the template suggestions. if (isset($variables['node'])) { $variables['theme_hook_suggestions'][] = 'page__node__' . $variables['node']->type; } // If this is a panel page. if ($panel_page = page_manager_get_current_page()) { // Add a generic suggestion for all panel pages. $variables['theme_hook_suggestions'][] = 'page__panel'; // Add the panel page machine name to the template suggestions. $variables['theme_hook_suggestions'][] = 'page__panel__' . $panel_page['name']; // If this is node_view panel if (isset($variables['node'])) { // Add panel page machine name and content type to the template suggestions. // e.g. "page__panel__node_view__blog" $variables['theme_hook_suggestions'][] = 'page__panel__' . $panel_page['name'] . '__' . $variables['node']->type; } } if (!empty($variables['node']) && $variables['node']->type == 'book' && !empty($variables['node']->parent_book)) { $variables['title'] = $variables['node']->parent_book->title; } }
/** * Assign theme hook suggestions for custom templates and pass color theme setting */ function gavias_laikafood_preprocess_page(&$vars, $hook) { if (isset($vars['node'])) { $suggest = "page__node__{$vars['node']->type}"; $vars['theme_hook_suggestions'][] = $suggest; } if (arg(0) == 'taxonomy' && arg(1) == 'term') { $term = taxonomy_term_load(arg(2)); $vars['theme_hook_suggestions'][] = 'page--taxonomy--vocabulary--' . $term->vid; } if ($panel_page = page_manager_get_current_page()) { // Add a generic suggestion for all panel pages. $vars['theme_hook_suggestions'][] = 'page__panel'; // Add the panel page machine name to the template suggestions. $vars['theme_hook_suggestions'][] = 'page__' . $panel_page['name']; // Add a body class for good measure. $body_classes[] = 'page-panel'; } $alias = drupal_get_path_alias($_GET['q']); if ($alias != $_GET['q']) { $vars['theme_hook_suggestions'][] = 'page__' . str_replace('-', '_', $alias); } }
/** * Override or insert variables into the html templates. * * @param $variables * An array of variables to pass to the theme template. * @param $hook * The name of the template being rendered ("html" in this case.) */ function hpszen_preprocess_html(&$variables, $hook) { // Add classes for page names and panels layouts. // @note Zen theme uses page_callback on menu_item for determining if this is // a panels page, but that assumes the page has a matching variant that // invokes panels, which is not always the case. if ($panels_display = panels_get_current_page_display()) { $variables['classes_array'][] = drupal_clean_css_identifier($panels_display->layout); } else { $variables['classes_array'][] = 'no-panels'; } if ($current_page = page_manager_get_current_page()) { $variables['classes_array'][] = drupal_clean_css_identifier($current_page['name']); } // Strip html from head title if ($variables['head_title']) { $variables['head_title'] = strip_tags(htmlspecialchars_decode($variables['head_title'])); } // Pass behaviour settings to javascript drupal_add_js(array('hpszen' => array('toggleSubNavigation' => theme_get_setting('hpszen_navigation_dropdown'), 'toggleRelatedItemDetail' => theme_get_setting('hpszen_exhibits_js'))), 'setting'); if (theme_get_setting('hpszen_position_sticky') && module_exists('libraries')) { foreach (array('fixedfixed', 'fixedsticky') as $library) { if ($library_path = libraries_get_path($library)) { $file_path = "{$library_path}/{$library}"; if (file_exists("{$file_path}.js")) { drupal_add_js("{$file_path}.js"); if (file_exists("{$file_path}.css")) { drupal_add_css("{$file_path}.css"); } } } } } // The body tag's classes are controlled by the $classes_array variable. To // remove a class from $classes_array, use array_diff(). //$variables['classes_array'] = array_diff($variables['classes_array'], array('class-to-remove')); }
/** * Assign theme hook suggestions for custom templates. */ function jollyany_preprocess_page(&$vars, $hook) { if (isset($vars['node'])) { $suggest = "page__{$vars['node']->type}"; $vars['theme_hook_suggestions'][] = $suggest; } $status = drupal_get_http_header("status"); if ($status == "404 Not Found") { $vars['theme_hook_suggestions'][] = 'page__404'; } if (arg(0) == 'taxonomy' && arg(1) == 'term') { $term = taxonomy_term_load(arg(2)); $vars['theme_hook_suggestions'][] = 'page--taxonomy--' . $term->vid; } // If this is a panel page, add template suggestions. if ($panel_page = page_manager_get_current_page()) { // Add a generic suggestion for all panel pages. $vars['theme_hook_suggestions'][] = 'page__panel'; // Add the panel page machine name to the template suggestions. $vars['theme_hook_suggestions'][] = 'page__' . $panel_page['name']; // Add a body class for good measure. $body_classes[] = 'page-panel'; } }
/** * Implements template_preprocess_page * * Add convenience variables and template suggestions. */ function eigefoundationtheme_preprocess_page(&$variables) { // EIGEDR-422 refactoring: // the only possible element (if exists) into the right sidebar (sidebar_second) // is the social media block, which is placed off the grid, // so it shouldn't be taken into count for the grid classes calculation // Convenience variables if (!empty($variables['page']['sidebar_first'])) { $left = $variables['page']['sidebar_first']; } $full_page_width = false; $current_path = drupal_get_path_alias(); if ($variables["is_front"]) { $full_page_width = true; } $node = isset($variables['node']) ? $variables['node'] : null; if (strpos($current_path, 'gender-statistics/gender-equality-index') !== false && (empty($node) || $node->type != 'gender_equality_policy')) { $full_page_width = true; } if (strpos($current_path, 'gender-statistics/women-and-men-in-the-eu-facts-and-figures') !== false) { $full_page_width = true; } $variables['main_grid'] = 'large-10 large-push-2 small-push-0'; if ($full_page_width) { $variables['main_grid'] = 'large-12'; } if (!empty($left)) { $variables['sidebar_first_grid'] = 'large-2 small-12 large-pull-10 '; $variables['sidebar_sec_grid'] = ''; } else { $variables['sidebar_first_grid'] = ''; $variables['sidebar_sec_grid'] = ''; } if ($panel_page = page_manager_get_current_page()) { if ($panel_page['name'] == 'page-country_profile' || $panel_page['name'] == 'page-country_about' || $panel_page['name'] == 'page-country_structures' || $panel_page['name'] == 'page-country_laws_policies' || $panel_page['name'] == 'page-country_methods_tools' || $panel_page['name'] == 'page-country_good_practices' || $panel_page['name'] == 'page-country_resources') { $variables['page']['content_header']['tabs'] = $variables['tabs']; unset($variables['tabs']); } if ($panel_page['name'] == 'page-eige_research' || $panel_page['name'] == 'page-eige_website' || $panel_page['name'] == 'page-eige_primo') { // tabs are appropriately placed in page via page manager/panel layout unset($variables['tabs']); } } // render search box programmatically $search_box_ref = drupal_get_form('search_block_form'); $search_box = drupal_render($search_box_ref); $variables['search_box'] = $search_box; // custom libraries for lexicon page gender-mainstreaming/concepts-and-definitions if (arg(0) == 'gender-mainstreaming' && arg(1) == 'concepts-and-definitions') { $theme_path = drupal_get_path('theme', 'eigefoundationtheme'); drupal_add_library('system', 'effects.highlight'); drupal_add_js($theme_path . '/js/CustomScrollbar/jquery.mCustomScrollbar.min.js', 'file'); drupal_add_css($theme_path . '/js/CustomScrollbar/jquery.mCustomScrollbar.css'); } // Adds settings for the Structure node ENGE interoperability (EIGEDR-249). if (isset($variables['node'])) { $node = $variables['node']; if ($node->type == "structure") { if (isset($node->field_eurogender_user_id) && isset($node->field_eurogender_user_id['und']) && isset($node->field_eurogender_user_id['und'][0]) && isset($node->field_eurogender_user_id['und'][0]['value'])) { global $conf; drupal_add_js(array('enge_website' => $conf['enge_website'], 'eurogender_actor_id' => $node->field_eurogender_user_id['und'][0]['value']), 'setting'); } } } // EIGEDR-331 home page carousel if (isset($variables['is_front']) && $variables['is_front']) { $theme_path = drupal_get_path('theme', 'eigefoundationtheme'); drupal_add_css($theme_path . '/js/owl-carousel/owl.carousel.css'); drupal_add_css($theme_path . '/js/owl-carousel/owl.theme.css'); drupal_add_js($theme_path . '/js/owl-carousel/owl.carousel.js', 'file'); } // EIGEDR-369 - hide default h1 from EuroGender event display $path = current_path(); if (strpos($path, 'events-calendar/event/') !== false) { $variables['title'] = ""; } // EIGEDR-278 - hide default h1 from Primo resource display if (strpos($path, 'rdc/library/resource/') !== false) { $variables['title'] = ""; } _panelize_gm_nodes($variables); }
/** * Implements hook_preprocess_page(). * * @see page.tpl.php */ function bootstrap_psdpt_preprocess_page(&$variables) { global $base_url; // Internationalization Settings. global $language; $is_multilingual = 0; if (module_exists('i18n_menu') && drupal_multilingual()) { $is_multilingual = 1; } // WxT Settings. $theme_prefix = 'wb'; $theme_menu_prefix = 'wet-fullhd'; $wxt_active = variable_get('wetkit_wetboew_theme', 'wet-boew'); $library_path = libraries_get_path($wxt_active, TRUE); $wxt_active = str_replace('-', '_', $wxt_active); $wxt_active = str_replace('wet_boew_', '', $wxt_active); // Extra variables to pass to templates. $variables['library_path'] = $library_path; $variables['language'] = $language->language; $variables['language_prefix'] = $language->prefix; $variables['language_prefix_alt'] = $language->prefix == 'en' ? 'fr' : 'fra'; // Site Name. if (!empty($variables['site_name'])) { $variables['site_name_title'] = filter_xss(variable_get('site_name', 'Drupal')); $variables['site_name_unlinked'] = $variables['site_name_title']; $variables['site_name_url'] = url(variable_get('site_frontpage', 'node')); $variables['site_name'] = trim($variables['site_name_title']); } // Logo settings. $default_logo = theme_get_setting('default_logo'); $default_svg_logo = theme_get_setting('wetkit_theme_svg_default_logo'); $default_logo_path = $variables['logo']; $default_svg_logo_path = theme_get_setting('wetkit_theme_svg_logo_path'); $toggle_logo = theme_get_setting('toggle_logo'); $variables['logo_class'] = ''; $variables['logo_svg'] = ''; // Toggle Logo off/on. if ($toggle_logo == 0) { $variables['logo'] = ''; $variables['logo_svg'] = ''; $variables['logo_class'] = drupal_attributes(array('class' => 'no-logo')); } // Default Logo. if ($default_logo == 1) { $variables['logo'] = $library_path . '/assets/logo.png'; $variables['logo_svg'] = $library_path . '/assets/logo.svg'; // GCWeb or GC Intranet. if ($wxt_active == 'gcweb' || $wxt_active == 'gc_intranet') { $variables['logo'] = $library_path . '/assets/sig-blk-' . $language->language . '.png'; $variables['logo_svg'] = $library_path . '/assets/sig-blk-' . $language->language . '.svg'; } elseif ($wxt_active == 'gcwu_fegc') { $variables['logo'] = $library_path . '/assets/sig-' . $language->language . '.png'; $variables['logo_svg'] = $library_path . '/assets/sig-' . $language->language . '.svg'; } } // Custom Logo. if ($default_logo == 0) { if ($default_svg_logo == 1) { $variables['logo_svg'] = $base_url . '/' . $default_svg_logo_path; } } // Default GCWeb misc. if ($wxt_active == 'gcweb') { $variables['logo_bottom'] = $library_path . '/assets/wmms-blk' . '.png'; $variables['logo_bottom_svg'] = $library_path . '/assets/wmms-blk' . '.svg'; } // Add information about the number of sidebars. if (!empty($variables['page']['sidebar_first']) && !empty($variables['page']['sidebar_second'])) { $variables['content_column_class'] = ' class="col-sm-6"'; } elseif (!empty($variables['page']['sidebar_first']) || !empty($variables['page']['sidebar_second'])) { $variables['content_column_class'] = ' class="col-sm-9"'; } else { $variables['content_column_class'] = ''; } // Primary menu. $variables['primary_nav'] = FALSE; if ($variables['main_menu']) { // Build links. $variables['primary_nav'] = menu_tree(variable_get('menu_main_links_source', 'main-menu')); // Provide default theme wrapper function. $variables['primary_nav']['#theme_wrappers'] = array('menu_tree__primary'); } // Secondary nav. $variables['secondary_nav'] = FALSE; if ($variables['secondary_menu']) { // Build links. $variables['secondary_nav'] = menu_tree(variable_get('menu_secondary_links_source', 'user-menu')); // Provide default theme wrapper function. $variables['secondary_nav']['#theme_wrappers'] = array('menu_tree__secondary'); } // Navbar. $variables['navbar_classes_array'] = array(''); if (theme_get_setting('bootstrap_navbar_position') !== '') { $variables['navbar_classes_array'][] = 'navbar-' . theme_get_setting('bootstrap_navbar_position'); } else { $variables['navbar_classes_array'][] = ''; } // Mega Menu Region. /* if (module_exists('menu_block') && empty($variables['mega_menu'])) { $menu_name = 'main_menu'; $data = array( '#pre_render' => array('_wetkit_menu_tree_build_prerender'), '#cache' => array( 'keys' => array('bootstrap_psdpt', 'menu', 'mega_menu', $menu_name), 'expire' => CACHE_TEMPORARY, 'granularity' => DRUPAL_CACHE_PER_ROLE ), '#menu_name' => $menu_name, ); $variables['page']['mega_menu'] = $data; }*/ // Splash Page. if (current_path() == 'splashify-splash') { // GCWeb Theme. if ($wxt_active == 'gcweb') { $variables['background'] = $library_path . '/img/splash/sp-bg-2.jpg'; } } // Panels Integration. if (module_exists('page_manager')) { // Page template suggestions for Panels pages. $panel_page = page_manager_get_current_page(); if (!empty($panel_page)) { // Add the active WxT theme machine name to the template suggestions. $suggestions[] = 'page__panels__' . $wxt_active; if (drupal_is_front_page()) { $suggestions[] = 'page__panels__' . $wxt_active . '__front'; } // Add the panel page machine name to the template suggestions. $suggestions[] = 'page__' . $panel_page['name']; // Merge the suggestions in to the existing suggestions // (as more specific than the existing suggestions). $variables['theme_hook_suggestions'] = array_merge($variables['theme_hook_suggestions'], $suggestions); $variables['panels_layout'] = TRUE; } else { $suggestions[] = 'page__' . $wxt_active; // Splash Page. if (current_path() == 'splashify-splash') { $suggestions[] = 'page__splash__' . $wxt_active; } // Merge the suggestions in to the existing suggestions (as more specific // than the existing suggestions). $variables['theme_hook_suggestions'] = array_merge($variables['theme_hook_suggestions'], $suggestions); } } // Header Navigation + Language Switcher. $menu = $is_multilingual ? i18n_menu_navigation_links('menu-wet-header') : menu_navigation_links('menu-wet-header'); $nav_bar_markup = theme('links__menu_menu_wet_header', array('links' => $menu, 'attributes' => array('id' => 'menu', 'class' => array('links', 'clearfix')), 'heading' => array('text' => 'Language Selection', 'level' => 'h2'))); $nav_bar_markup = strip_tags($nav_bar_markup, '<h2><li><a>'); if (module_exists('wetkit_language')) { $language_link_markup = '<li id="' . $theme_menu_prefix . '-lang">' . strip_tags($variables['menu_lang_bar'], '<a><span>') . '</li>'; if ($wxt_active == 'gcweb') { $variables['menu_bar'] = '<ul class="list-inline margin-bottom-none">' . $language_link_markup . '</ul>'; } else { if ($wxt_active == 'gcwu_fegc') { $variables['menu_bar'] = '<ul id="gc-bar" class="list-inline">' . preg_replace("/<h([1-6]{1})>.*?<\\/h\\1>/si", '', $nav_bar_markup) . $language_link_markup . '</ul>'; } else { if ($wxt_active == 'gc_intranet') { $variables['menu_bar'] = '<ul id="gc-bar" class="list-inline">' . $language_link_markup . '</ul>'; } else { $variables['menu_bar'] = '<ul class="text-right">' . preg_replace("/<h([1-6]{1})>.*?<\\/h\\1>/si", '', $nav_bar_markup) . $language_link_markup . '</ul>'; } } } } else { $variables['menu_bar'] = '<ul class="text-right">' . preg_replace("/<h([1-6]{1})>.*?<\\/h\\1>/si", '', $nav_bar_markup) . '</ul>'; } // Custom Search Box. if (module_exists('custom_search')) { $custom_search_form_name = 'custom_search_blocks_form_1'; $custom_search = array('#pre_render' => array('__wetkit_custom_search_prerender'), '#cache' => array('keys' => array('bootstrap_psdpt', 'custom_search', $custom_search_form_name), 'expire' => CACHE_TEMPORARY, 'granularity' => DRUPAL_CACHE_PER_USER), '#custom_search_form_name' => $custom_search_form_name, '#wxt_active' => $wxt_active); $variables['custom_search'] = $custom_search; // CDN Support. if ($wxt_active == 'gcweb') { $gcweb_cdn = theme_get_setting('gcweb_cdn'); if (!empty($gcweb_cdn)) { $variables['gcweb_cdn'] = TRUE; } else { $variables['gcweb_cdn'] = FALSE; } } // Visibility settings. $pages = drupal_strtolower(theme_get_setting('wetkit_search_box')); // Convert the Drupal path to lowercase. $path = drupal_strtolower(drupal_get_path_alias($_GET['q'])); // Compare the lowercase internal and lowercase path alias (if any). $page_match = drupal_match_path($path, $pages); if ($path != $_GET['q']) { $page_match = $page_match || drupal_match_path($_GET['q'], $pages); } // When $visibility has a value of 0 (VISIBILITY_NOTLISTED), // the block is displayed on all pages except those listed in $pages. // When set to 1 (VISIBILITY_LISTED), it is displayed only on those // pages listed in $pages. $visibility = 0; $page_match = !(0 xor $page_match); if ($page_match) { $variables['search_box'] = render($variables['custom_search']); $variables['search_box'] = str_replace('type="text"', 'type="search"', $variables['search_box']); } else { $variables['search_box'] = ''; } } // Terms Navigation. $menu = $is_multilingual ? i18n_menu_navigation_links('menu-wet-terms') : menu_navigation_links('menu-wet-terms'); $class = $wxt_active == 'gcwu_fegc' || $wxt_active == 'gc_intranet' ? array('list-inline') : array('links', 'clearfix'); $terms_bar_markup = theme('links__menu_menu_wet_terms', array('links' => $menu, 'attributes' => array('id' => 'gc-tctr', 'class' => $class), 'heading' => array())); $variables['page']['menu_terms_bar'] = $terms_bar_markup; // Mid Footer Region. if (module_exists('menu_block')) { $menu_name = 'mid_footer_menu'; $data = array('#pre_render' => array('_wetkit_menu_tree_build_prerender'), '#cache' => array('keys' => array('bootstrap_psdpt', 'menu', 'footer', $menu_name), 'expire' => CACHE_TEMPORARY, 'granularity' => DRUPAL_CACHE_PER_ROLE), '#menu_name' => $menu_name); $variables['page']['footer']['minipanel'] = $data; } // Unset powered by block. unset($variables['page']['footer']['system_powered-by']); // Footer Navigation. $menu = $is_multilingual ? i18n_menu_navigation_links('menu-wet-footer') : menu_navigation_links('menu-wet-footer'); $class = $wxt_active == 'gcwu_fegc' || $wxt_active == 'gc_intranet' ? array('list-inline') : array('links', 'clearfix'); $footer_bar_markup = theme('links__menu_menu_wet_footer', array('links' => $menu, 'attributes' => array('id' => 'menu', 'class' => $class), 'heading' => array())); $variables['page']['menu_footer_bar'] = $footer_bar_markup; // Footer Navigation (gcweb). if ($wxt_active == 'gcweb') { $variables['gcweb'] = array('feedback' => array('en' => 'http://www.canada.ca/en/contact/feedback.html', 'fr' => 'http://www.canada.ca/fr/contact/retroaction.html'), 'social' => array('en' => 'http://www.canada.ca/en/social/index.html', 'fr' => 'http://www.canada.ca/fr/sociaux/index.html'), 'mobile' => array('en' => 'http://www.canada.ca/en/mobile/index.html', 'fr' => 'http://www.canada.ca/fr/mobile/index.html')); } }
/** * Implements template_preprocess_page. */ function vac_preprocess_page(&$variables) { if (!module_exists('page_manager') || !page_manager_get_current_page()) { $variables['not_panels'] = TRUE; } }
/** * Override or insert variables into the page template. * * Implements template_process_page(). */ function kalatheme_process_page(&$variables) { // Hook into color.module. if (module_exists('color')) { _color_page_alter($variables); } // Define variables to theme local actions as a dropdown. $dropdown_attributes = array('container' => array('class' => array('dropdown', 'actions', 'pull-right')), 'toggle' => array('class' => array('dropdown-toggle', 'enabled'), 'data-toggle' => array('dropdown'), 'href' => array('#')), 'content' => array('class' => array('dropdown-menu'))); // Add local actions as the last item in the local tasks. if (!empty($variables['action_links'])) { $variables['tabs']['#primary'][]['#markup'] = theme('menu_local_actions', array('menu_actions' => $variables['action_links'], 'attributes' => $dropdown_attributes)); $variables['action_links'] = FALSE; } // Get the entire main menu tree. $main_menu_tree = array(); $main_menu_tree = menu_tree_all_data('main-menu', NULL, 2); // Add the rendered output to the $main_menu_expanded variable. $variables['main_menu_expanded'] = menu_tree_output($main_menu_tree); // Always print the site name and slogan, but if they are toggled off, we'll // just hide them visually. $variables['hide_site_name'] = theme_get_setting('toggle_name') ? FALSE : TRUE; $variables['hide_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE : TRUE; if ($variables['hide_site_name']) { // If toggle_name is FALSE, the site_name will be empty, so we rebuild it. $variables['site_name'] = filter_xss_admin(variable_get('site_name', 'Drupal')); } if ($variables['hide_site_slogan']) { // If toggle_site_slogan is FALSE, the site_slogan will be empty, // so we rebuild it. $variables['site_slogan'] = filter_xss_admin(variable_get('site_slogan', '')); } // Since the title and the shortcut link are both block level elements, // positioning them next to each other is much simpler with a wrapper div. if (!empty($variables['title_suffix']['add_or_remove_shortcut']) && $variables['title']) { // Add a wrapper div using title_prefix and title_suffix render elements. $variables['title_prefix']['shortcut_wrapper'] = array('#markup' => '<div class="shortcut-wrapper clearfix">', '#weight' => 100); $variables['title_suffix']['shortcut_wrapper'] = array('#markup' => '</div>', '#weight' => -99); // Make sure the shortcut link is the first item in title_suffix. $variables['title_suffix']['add_or_remove_shortcut']['#weight'] = -100; } // If panels arent being used at all. $variables['no_panels'] = !(module_exists('page_manager') && page_manager_get_current_page()); // Check if we're to always print the page title, even on panelized pages. $variables['always_show_page_title'] = theme_get_setting('always_show_page_title') ? TRUE : FALSE; }
/** * Implements template_preprocess_page(). */ function radix_preprocess_page(&$variables) { // Determine if the page is rendered using panels. $variables['is_panel'] = FALSE; if (module_exists('page_manager') && count(page_manager_get_current_page())) { $variables['is_panel'] = TRUE; } // Make sure tabs is empty. if (empty($variables['tabs']['#primary']) && empty($variables['tabs']['#secondary'])) { $variables['tabs'] = ''; } // Theme action links as buttons. if (!empty($variables['action_links'])) { foreach (element_children($variables['action_links']) as $key) { $variables['action_links'][$key]['#link']['localized_options']['attributes'] = array('class' => array('btn', 'btn-primary', 'btn-sm')); } } // Add search_form to theme. $variables['search_form'] = ''; if (module_exists('search') && user_access('search content')) { $search_box_form = drupal_get_form('search_form'); $search_box_form['basic']['keys']['#title'] = 'Search'; $search_box_form['basic']['keys']['#title_display'] = 'invisible'; $search_box_form['basic']['keys']['#size'] = 20; $search_box_form['basic']['keys']['#attributes'] = array('placeholder' => 'Search'); $search_box_form['basic']['keys']['#attributes']['class'][] = 'form-control'; $search_box_form['basic']['submit']['#value'] = t('Search'); $search_box_form['#attributes']['class'][] = 'navbar-form'; $search_box_form['#attributes']['class'][] = 'navbar-right'; $search_box = drupal_render($search_box_form); $variables['search_form'] = user_access('search content') ? $search_box : NULL; } // Format and add main menu to theme. $variables['main_menu'] = menu_tree(variable_get('menu_main_links_source', 'main-menu')); $variables['main_menu']['#theme_wrappers'] = array(); // Add a copyright message. $variables['copyright'] = t('Drupal is a registered trademark of Dries Buytaert.'); // Display a message if Sass has not been compiled. // $theme_path = drupal_get_path('theme', $GLOBALS['theme']); // $stylesheet_path = $theme_path . '/assets/stylesheets/screen.css'; // if (_radix_current_theme() == 'radix') { // $stylesheet_path = $theme_path . '/assets/stylesheets/radix-style.css'; // } // if (!file_exists($stylesheet_path)) { // drupal_set_message(t('It looks like %path has not been created yet. Run <code>@command</code> in your theme directory to create it.', array( // '%path' => $stylesheet_path, // '@command' => 'compass watch', // )), 'error'); // } }
/** * * Implements template_prerocess_page(). */ function helm_base_preprocess_page(&$vars) { // If panels arent being used at all. $vars['no_panels'] = !(module_exists('page_manager') && page_manager_get_current_page()); $vars['copyright'] = ''; }
<div id="breadcrumb-wrapper"> <section class="breadcrumb clearfix"> <?php print $breadcrumb; ?> </section> </div> <?php } ?> <?php print render($title_prefix); ?> <?php if ($title && (!isset($node) || page_manager_get_current_page())) { ?> <header class="clearfix"> <h1 id="page-title"><?php print $title; ?> </h1> </header> <?php } ?> <?php print render($title_suffix); ?> <?php
/** * Override or insert variables for the page templates. */ function commons_origins_preprocess_page(&$vars) { if (module_exists('page_manager')) { $p = page_manager_get_current_page(); if (isset($p['name']) && $p['name'] == 'node_view') { $node = $p['contexts']['argument_entity_id:node_1']->data; if (module_exists('og') && !og_is_group('node', $node)) { $vars['hide_panelized_title'] = 1; } } } }
/** * Override or insert variables into the page template. * * Implements template_process_page(). */ function playbox_theme_process_page(&$variables) { // Add Bootstrap JS and stock CSS. global $base_url; $base = parse_url($base_url); // Use the CDN if not using libraries if (!kalatheme_use_libraries()) { $library = theme_get_setting('bootstrap_library'); if ($library !== 'none' && !empty($library)) { // Add the JS drupal_add_js($base['scheme'] . ":" . KALATHEME_BOOTSTRAP_JS, 'external'); // Add the CSS $css = $library === 'default' ? KALATHEME_BOOTSTRAP_CSS : kalatheme_get_bootswatch_theme($library)->cssCdn; drupal_add_css($base['scheme'] . ":" . $css, 'external'); } } // Use Font Awesome if (theme_get_setting('fontawesome')) { drupal_add_css($base['scheme'] . ":" . KALATHEME_FONTAWESOME_CSS, 'external'); } // Define variables to theme local actions as a dropdown. $dropdown_attributes = array('container' => array('class' => array('dropdown', 'actions', 'pull-right')), 'toggle' => array('class' => array('dropdown-toggle', 'enabled'), 'data-toggle' => array('dropdown'), 'href' => array('#')), 'content' => array('class' => array('dropdown-menu'))); // Add local actions as the last item in the local tasks. if (!empty($variables['action_links'])) { $variables['tabs']['#primary'][]['#markup'] = theme('menu_local_actions', array('menu_actions' => $variables['action_links'], 'attributes' => $dropdown_attributes)); $variables['action_links'] = FALSE; } // Get the entire main menu tree. $right_menu_tree = array(); $right_menu_tree = menu_tree_all_data('menu-right-main-menu', NULL, 2); $left_menu_tree = array(); $left_menu_tree = menu_tree_all_data('menu-left-main-menu', NULL, 2); // Add the rendered output to the ${left|right}_menu_expanded variable. $variables['left_menu_expanded'] = menu_tree_output($left_menu_tree); $variables['right_menu_expanded'] = menu_tree_output($right_menu_tree); $variables['main_menu'] = $left_menu_tree & $right_menu_tree; // Always print the site name and slogan, but if they are toggled off, we'll // just hide them visually. $variables['hide_site_name'] = theme_get_setting('toggle_name') ? FALSE : TRUE; $variables['hide_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE : TRUE; if ($variables['hide_site_name']) { // If toggle_name is FALSE, the site_name will be empty, so we rebuild it. $variables['site_name'] = filter_xss_admin(variable_get('site_name', 'Drupal')); } if ($variables['hide_site_slogan']) { // If toggle_site_slogan is FALSE, the site_slogan will be empty, // so we rebuild it. $variables['site_slogan'] = filter_xss_admin(variable_get('site_slogan', '')); } // Since the title and the shortcut link are both block level elements, // positioning them next to each other is much simpler with a wrapper div. if (!empty($variables['title_suffix']['add_or_remove_shortcut']) && $variables['title']) { // Add a wrapper div using title_prefix and title_suffix render elements. $variables['title_prefix']['shortcut_wrapper'] = array('#markup' => '<div class="shortcut-wrapper clearfix">', '#weight' => 100); $variables['title_suffix']['shortcut_wrapper'] = array('#markup' => '</div>', '#weight' => -99); // Make sure the shortcut link is the first item in title_suffix. $variables['title_suffix']['add_or_remove_shortcut']['#weight'] = -100; } // If panels arent being used at all. $variables['no_panels'] = !(module_exists('page_manager') && page_manager_get_current_page()); // Check if we're to always print the page title, even on panelized pages. $variables['always_show_page_title'] = theme_get_setting('always_show_page_title') ? TRUE : FALSE; // Add js variable for path for the logo & alt logo that we will need on larger screens & alt screens. drupal_add_js('jQuery.extend(Drupal.settings, { "logo_white": "' . theme_get_setting('logo_white') . '" });', 'inline'); drupal_add_js('jQuery.extend(Drupal.settings, { "logo": "' . theme_get_setting('logo') . '" });', 'inline'); }
/** * Preprocess variables for page template. */ function spacelab_preprocess_page(&$vars) { // Get the entire main menu tree. $main_menu_tree = array(); $main_menu_tree = menu_tree_all_data('main-menu', NULL, 2); // Add the rendered output to the $main_menu_expanded variable. $vars['main_menu_expanded'] = menu_tree_output($main_menu_tree); // Always print the site name and slogan, but if they are toggled off, we'll // just hide them visually. $vars['hide_site_name'] = theme_get_setting('toggle_name') ? FALSE : TRUE; $vars['hide_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE : TRUE; if ($vars['hide_site_name']) { // If toggle_name is FALSE, the site_name will be empty, so we rebuild it. $vars['site_name'] = filter_xss_admin(variable_get('site_name', 'Drupal')); } if ($vars['hide_site_slogan']) { // If toggle_site_slogan is FALSE, the site_slogan will be empty, // so we rebuild it. $vars['site_slogan'] = filter_xss_admin(variable_get('site_slogan', '')); } // Since the title and the shortcut link are both block level elements, // positioning them next to each other is much simpler with a wrapper div. if (!empty($vars['title_suffix']['add_or_remove_shortcut']) && $vars['title']) { // Add a wrapper div using title_prefix and title_suffix render elements. $vars['title_prefix']['shortcut_wrapper'] = array('#markup' => '<div class="shortcut-wrapper clearfix">', '#weight' => 100); $vars['title_suffix']['shortcut_wrapper'] = array('#markup' => '</div>', '#weight' => -99); // Make sure the shortcut link is the first item in title_suffix. $vars['title_suffix']['add_or_remove_shortcut']['#weight'] = -100; } // If panels arent being used at all. $vars['no_panels'] = !(module_exists('page_manager') && page_manager_get_current_page()); // Check if we're to always print the page title, even on panelized pages. $vars['always_show_page_title'] = theme_get_setting('always_show_page_title') ? TRUE : FALSE; /** * insert variables into page template. */ if ($vars['page']['sidebar_first'] && $vars['page']['sidebar_second']) { $vars['sidebar_grid_class'] = 'col-md-3'; $vars['main_grid_class'] = 'col-md-6'; } elseif ($vars['page']['sidebar_first'] || $vars['page']['sidebar_second']) { $vars['sidebar_grid_class'] = 'col-md-3'; $vars['main_grid_class'] = 'col-md-9'; } else { $vars['main_grid_class'] = 'col-md-12'; } if ($vars['page']['header_top_left'] && $vars['page']['header_top_right']) { $vars['header_top_left_grid_class'] = 'col-md-8'; $vars['header_top_right_grid_class'] = 'col-md-4'; } elseif ($vars['page']['header_top_right'] || $vars['page']['header_top_left']) { $vars['header_top_left_grid_class'] = 'col-md-12'; $vars['header_top_right_grid_class'] = 'col-md-12'; } }
/** * Implements template_preprocess_page. */ function fin_preprocess_page(&$variables) { if (!(module_exists('page_manager') && page_manager_get_current_page())) { $variables['not_panels'] = 'row'; } }
/** * Implements template_preprocess_page */ function smash_minisite_theme_preprocess_page(&$variables) { $variables['site_name'] = t('Get involved.'); if (function_exists('page_manager_get_current_page')) { $page = page_manager_get_current_page(); if (!empty($page) && isset($page['name'])) { if ($page['name'] == 'page-position_list' || $page['name'] == 'page-role_selector') { $variables['title_prefix'] = '<div class="element-invisible">'; $variables['title_suffix'] = '</div>'; } } } }
/** * Override or insert variables for the page templates. */ function commons_beehive_preprocess_page(&$variables, $hook) { if (module_exists('page_manager')) { $p = page_manager_get_current_page(); if (isset($p['name']) && $p['name'] == 'node_view') { $node = $p['contexts']['argument_entity_id:node_1']->data; if (module_exists('og') && !og_is_group('node', $node)) { $variables['hide_panelized_title'] = 1; } } } $variables['header_attributes_array']['class'][] = 'container'; $cf_pos = in_array('clearfix', $variables['branding_attributes_array']['class']); unset($variables['branding_attributes_array']['class'][$cf_pos]); // Only load the media styles if Commons Media is enabled. if (module_exists('commons_media')) { drupal_add_css(drupal_get_path('theme', 'commons_beehive') . '/css/commons-media.css', array('media' => 'screen', 'group' => CSS_THEME)); } }
/** * Implements template_preprocess_page(). */ function radix_preprocess_page(&$variables) { global $base_url; // Add Bootstrap JS from CDN if bootstrap library is not installed. if (!module_exists('bootstrap_library')) { $base = parse_url($base_url); drupal_add_js($base['scheme'] . '://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js', 'external'); } // Add support for the Modenizr module. // Load modernizr.js only if modernizr module is not present. if (!module_exists('modernizr')) { drupal_add_js(drupal_get_path('theme', 'radix') . '/assets/javascripts/modernizr.js'); } // Determine if the page is rendered using panels. $variables['is_panel'] = FALSE; if (module_exists('page_manager') && count(page_manager_get_current_page())) { $variables['is_panel'] = TRUE; } // Make sure tabs is empty. if (empty($variables['tabs']['#primary']) && empty($variables['tabs']['#secondary'])) { $variables['tabs'] = ''; } // Theme action links as buttons. foreach ($variables['action_links'] as $key => &$link) { $link['#link']['localized_options']['attributes'] = array('class' => array('btn', 'btn-primary')); } // Add search_form to theme. $variables['search_form'] = ''; if (module_exists('search') && user_access('search content')) { $search_box_form = drupal_get_form('search_form'); $search_box_form['basic']['keys']['#title'] = ''; $search_box_form['basic']['keys']['#size'] = 20; $search_box_form['basic']['keys']['#attributes'] = array('placeholder' => 'Search'); $search_box_form['basic']['keys']['#attributes']['class'][] = 'form-control'; $search_box_form['basic']['submit']['#value'] = t('Search'); $search_box_form['#attributes']['class'][] = 'navbar-form'; $search_box_form['#attributes']['class'][] = 'navbar-right'; $search_box = drupal_render($search_box_form); $variables['search_form'] = user_access('search content') ? $search_box : NULL; } // Format and add main menu to theme. $variables['main_menu'] = menu_tree(variable_get('menu_main_links_source', 'main-menu')); $variables['main_menu']['#theme_wrappers'] = array(); // Add a copyright message. $variables['copyright'] = t('Drupal is a registered trademark of Dries Buytaert.'); // Display a message if Sass has not been compiled. $theme_path = drupal_get_path('theme', $GLOBALS['theme']); $stylesheet_path = $theme_path . '/assets/stylesheets/screen.css'; if (_radix_current_theme() == 'radix') { $stylesheet_path = $theme_path . '/assets/stylesheets/radix-style.css'; } elseif (_radix_base_theme() == 'radix') { $stylesheet_path = $theme_path . '/assets/stylesheets/screen.css'; } else { // If this isn't radix and it isn't a *direct* sub-theme, then we don't // perform this check (ie. if it's a sub-sub-theme). $stylesheet_path = NULL; } if ($stylesheet_path && !file_exists($stylesheet_path)) { drupal_set_message(t('It looks like %path has not been created yet. Run <code>@command</code> in your theme directory to create it.', array('%path' => $stylesheet_path, '@command' => 'compass watch')), 'error'); } }