/** * Implemements hook_process_page * @param array $variables */ function fs_core_preprocess_page(&$variables) { //Search form $search_form = drupal_get_form('search_form'); $search_form_box = drupal_render($search_form); $variables['search_box'] = $search_form_box; if ($views_page = views_get_page_view()) { $variables['theme_hook_suggestions'][] = 'page__views__' . $views_page->name; $variables['theme_hook_suggestions'][] = 'page__views__' . $views_page->name . '_' . $views_page->current_display; } if (isset($variables['node']->type)) { $variables['theme_hook_suggestions'][] = 'page__' . $variables['node']->type; } // changes the links tree for the main menu, since by // default Drupal just provides first level ones $menu_tree = menu_tree_all_data('main-menu'); $menu_tree = menu_tree_output($menu_tree); foreach ($menu_tree as $k => $v) { if (is_numeric($k) && count($v['#below'])) { $menu_tree[$k]['#below']['#theme_wrappers'][0] = 'menu_tree__submenu'; } } $variables['main_menu'] = $menu_tree; if (arg(0) == 'taxonomy' && arg(1) == 'term') { $tid = (int) arg(2); $term = taxonomy_term_load($tid); if (is_object($term)) { $variables['theme_hook_suggestions'][] = 'page__taxonomy__' . $term->vocabulary_machine_name; } } }
/** * Processes variables for block.tpl.php. * * Prepares the values passed to the theme_block function to be passed * into a pluggable template engine. Uses block properties to generate a * series of template file suggestions. If none are found, the default * block.tpl.php is used. * * Most themes utilize their own copy of block.tpl.php. The default is located * inside "modules/block/block.tpl.php". Look in there for the full list of * variables. * * The $variables array contains the following arguments: * - $block * * @see block.tpl.php */ function scsmetronic_subtheme_preprocess_page(&$variables) { global $user; if (variable_get('scsmetronic_redirect_to_login') && $user->uid == 0 && arg(0) != 'user') { //header('Location: ' . url('user/login', array( 'absolute' => TRUE)), TRUE, 302); // Handle redirection to the login form. // using drupal_goto() with destination set causes a recursive redirect loop $login_path = 'user/login'; $code = 302; // The code in drupal_get_destination() doesn't preserve any query string // on 403 pages, so reproduce the part we want here. $path = isset($_GET['destination']) ? $_GET['destination'] : '<front>'; $query = drupal_http_build_query(drupal_get_query_parameters(NULL, array('q', 'destination'))); if ($query != '') { $path .= '?' . $query; } $destination = array('destination' => $path); header('Location: ' . url($login_path, array('query' => $destination, 'absolute' => TRUE)), TRUE, 302); drupal_exit(); } $variables['navbar_top'] = 'navbar-static-top'; $theme_header = theme_get_setting('theme_header', 'scsmetronic'); if (!empty($theme_header) && $theme_header !== 'default') { $variables['navbar_top'] = 'navbar-fixed-top'; } //Get the entire main menu tree $main_menu_name = theme_get_setting('theme_main_menu', 'scsmetronic'); $main_menu_tree = menu_tree_all_data($main_menu_name); $user_menu_tree = menu_tree_all_data('user-menu'); //Add the rendered output to the $main_menu_expanded variable $variables['main_menu_expanded'] = menu_tree_output($main_menu_tree); $variables['user_menu_expanded'] = menu_tree_output($user_menu_tree); if ($modal_form_paths = theme_get_setting('theme_modal')) { $modal_forms = explode("\r\n", $modal_form_paths); drupal_add_js(array('scsmetronic_forms_modal' => $modal_forms), 'setting'); } if ($user->uid) { $name = theme('username', array('account' => $user, 'link_path' => NULL)); } else { $name = variable_get('anonymous', t('Guest')); } $variables['loggedin_user_name'] = $name; $variables['image'] = scsmetronic_login_user_image($user); }
/** * Implements theme_links() targeting the main menu topbar. * Override base template, which would add the class of "left",which we don't need */ function qualiceutics__topbar_main_menu($variables) { // We need to fetch the links ourselves because we need the entire tree. $links = menu_tree_output(menu_tree_all_data(variable_get('menu_main_links_source', 'main-menu'))); $output = _zurb_foundation_links($links); return '<ul' . drupal_attributes($variables['attributes']) . '>' . $output . '</ul>'; }
/** * Implements theme_links() targeting the secondary menu topbar. */ function mdl_links__topbar_secondary_menu($variables) { // We need to fetch the links ourselves because we need the entire tree. $links = menu_tree_output(menu_tree_all_data(variable_get('menu_secondary_links_source', 'user-menu'))); $output = _mdl_links($links); return '<nav' . drupal_attributes($variables['attributes']) . '>' . $output . '</nav>'; }
/** * Preprocessor for page.tpl.php template file. */ function msd15_preprocess_page(&$vars, $hook) { // Get the entire main menu tree $main_menu_tree = menu_tree_all_data('main-menu'); $vars['menu_tree_all_data'] = $main_menu_tree; // Add the rendered output to the $main_menu_expanded variable $vars['main_menu_expanded'] = menu_tree_output($main_menu_tree); if (isset($vars['node']->type)) { // We don't want to apply this on taxonomy or view pages // Splice (2) is based on existing default suggestions. Change it if you need to. array_splice($vars['theme_hook_suggestions'], -1, 0, 'page__' . $vars['node']->type); // Get the url_alias and make each item part of an array $url_alias = drupal_get_path_alias($_GET['q']); $split_url = explode('/', $url_alias); // Add the full path template pages // Insert 2nd to last to allow page--node--[nid] to be last $cumulative_path = ''; foreach ($split_url as $path) { $cumulative_path .= '__' . $path; $path_name = 'page' . $cumulative_path; array_splice($vars['theme_hook_suggestions'], -1, 0, str_replace('-', '_', $path_name)); } // This does just the page name on its own & is considered more specific than the longest path // (because sometimes those get too long) // Also we don't want to do this if there were no paths on the URL // Again, add 2nd to last to preserve page--node--[nid] if we do add it in if (count($split_url) > 1) { $page_name = end($split_url); array_splice($vars['theme_hook_suggestions'], -1, 0, 'page__' . str_replace('-', '_', $page_name)); } } }
/** * Implements theme_links() targeting the secondary menu topbar. */ function drupalcampbelgium_links__topbar_secondary_menu($variables) { // We need to fetch the links ourselves because we need the entire tree. $links = menu_tree_output(menu_tree_all_data(variable_get('menu_secondary_links_source', 'user-menu'))); $output = _zurb_foundation_links($links); $variables['attributes']['class'][] = 'center-buttons'; return '<ul' . drupal_attributes($variables['attributes']) . '>' . $output . '</ul>'; }
function fever_preprocess_page(&$vars) { // .... // Get the entire main menu tree $main_menu_tree = menu_tree_all_data('main-menu'); // Add the rendered output to the $main_menu_expanded variable $vars['main_menu_expanded'] = menu_tree_output($main_menu_tree); }
function courage_admin_preprocess_page(&$variables) { $main_menu_tree = menu_tree_all_data('management'); $link = array('#theme' => 'item_list', '#items' => array(l('Home', url('<front>')))); $link['home'] = array('#theme' => 'link', '#text' => t('Home'), '#path' => '<front>', '#options' => array('attributes' => array(), 'html' => TRUE)); $main_menu_output = menu_tree_output($main_menu_tree); array_unshift($main_menu_output, $link); $variables['primary_main_menu'] = render($main_menu_output); }
/** * Display submenu on menu items. */ function carpediem_process_page(&$variables) { // Array with the names of the menus $menu_names = array('menu-logopedie', 'menu-kinesitherapie'); foreach ($menu_names as $menu_name) { $menu_tree = menu_tree_all_data($menu_name); $variables[$menu_name] = menu_tree_output($menu_tree); } }
/** * Formats the menu links for the child pages of the current page. * * @param array $book_link * A fully loaded menu link that is part of the book hierarchy. * * @return string * HTML for the links to the child pages of the current page. */ function _bootstrap_book_children($book_link) { // Rebuild entire menu tree for the book. $tree = menu_build_tree($book_link['menu_name']); $tree = menu_tree_output($tree); // Fix the theme hook suggestions. _bootstrap_book_fix_theme_hooks($book_link['nid'], $tree); // Return the rendered output. return drupal_render($tree); }
/** * 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 theme_preprocess_page(). */ function townsquare_bootstrap_preprocess_page(&$vars) { global $user; $vars['primary_local_tasks'] = menu_primary_local_tasks(); $vars['secondary_local_tasks'] = menu_secondary_local_tasks(); // The following menu stuff is lame foreach ($vars['main_menu'] as $item => $options) { $vars['main_menu'][$item]['html'] = TRUE; $vars['main_menu'][$item]['attributes']['id'] = 'menu-link-' . drupal_clean_css_identifier($options['href']); } $admin_menu = menu_tree_all_data('management'); $children = array_pop($admin_menu); if ($children) { foreach ($children['below'] as $key => $value) { $children['below'][$key]['below'] = array(); } $vars['admin_menu'] = menu_tree_output($children['below']); } // Add user picture if logged in if ($user->uid) { $vars['user_name'] = check_plain($user->name); if (!empty($user->picture)) { if (is_numeric($user->picture)) { $user->picture = file_load($user->picture); } if (!empty($user->picture->uri)) { $filepath = $user->picture->uri; } } elseif (variable_get('user_picture_default', '')) { $filepath = variable_get('user_picture_default', ''); } if (isset($filepath)) { $alt = t("@user's picture", array('@user' => format_username($user))); if (module_exists('image') && file_valid_uri($filepath) && ($style = variable_get('user_picture_style', ''))) { $vars['user_picture'] = theme('image_style', array('style_name' => $style, 'path' => $filepath, 'alt' => $alt, 'title' => $alt)); } else { $vars['user_picture'] = theme('image', array('path' => $filepath, 'alt' => $alt, 'title' => $alt)); } } else { $vars['user_picture'] = '<i class="icon-user"></i>'; } } else { unset($vars['secondary_menu']); $vars['login'] = drupal_get_form('user_login_block'); } // Add Bootstrap $path = libraries_get_path('bootstrap'); drupal_add_css($path . '/css/bootstrap.css'); drupal_add_css($path . '/css/bootstrap-responsive.css'); drupal_add_js($path . '/js/bootstrap.js'); $path = libraries_get_path('font-awesome'); drupal_add_css($path . '/css/font-awesome.css'); }
/** * Implements hook_preprocess_region(). */ function spartan_preprocess_region(&$vars) { global $language; switch ($vars['region']) { // Menu region. case 'menu': $footer_menu_cache = cache_get("footer_menu_data:" . $language->language); if ($footer_menu_cache) { $footer_menu = $footer_menu_cache->data; } else { $footer_menu = menu_tree_output(_spartan_menu_build_tree('main-menu', array('max_depth' => 2))); cache_set("footer_menu_data:" . $language->language, $footer_menu); } //set the active trail $active_trail = menu_get_active_trail(); foreach ($active_trail as $trail) { if (isset($trail['mlid']) && isset($footer_menu[$trail['mlid']])) { $footer_menu[$trail['mlid']]['#attributes']['class'][] = 'active-trail'; } } $vars['dropdown_menu'] = $footer_menu; break; // Default footer content. // Default footer content. case 'footer_first': $footer_menu_cache = cache_get("footer_menu_data:" . $language->language); if ($footer_menu_cache) { $footer_menu = $footer_menu_cache->data; } else { $footer_menu = menu_tree_output(_spartan_menu_build_tree('main-menu', array('max_depth' => 2))); cache_set("footer_menu_data:" . $language->language, $footer_menu); } //set the active trail $active_trail = menu_get_active_trail(); foreach ($active_trail as $trail) { if (isset($trail['mlid']) && isset($footer_menu[$trail['mlid']])) { $footer_menu[$trail['mlid']]['#attributes']['class'][] = 'active-trail'; } } $vars['footer_menu'] = $footer_menu; $vars['site_name'] = $site_name = variable_get('site_name'); $vars['footer_logo'] = l(theme('image', array('path' => drupal_get_path('theme', 'spartan') . "/logo-sm.png", 'alt' => "{$site_name} logo")), '', array("html" => TRUE, 'attributes' => array('class' => 'logo'))); if (function_exists('defaultcontent_get_node') && ($node = defaultcontent_get_node("email_update"))) { $node = node_view($node); $vars['subscribe_form'] = $node['webform']; } //krumo($vars['footer_menu']); break; } }
/** * Override or insert variables into the page template. * * Implements template_process_block(). */ function innovation_preprocess_block(&$variables) { $block = $variables['block']; if ($block->delta == 'main-menu' && $block->module == 'system' && $block->status == 1 && ($block->theme = 'innovation')) { // 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. // $main_menu_asu = menu_tree_output($main_menu_tree); $pri_attributes = array('class' => array('nav', 'navbar-nav', 'links', 'clearfix')); $variables['content'] = theme('links__system_main_menu', array('links' => $main_menu_asu, 'attributes' => $pri_attributes, 'heading' => array('text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible')))); $block->subject = ''; } }
/** * Implements theme_links() targeting the main menu specifically. * Formats links for Top Bar http://foundation.zurb.com/docs/components/top-bar.html */ function metroblocks_links__topbar_main_menu($variables) { // We need to fetch the links ourselves because we need the entire tree. $links = menu_tree_output(menu_tree_all_data(variable_get('menu_main_links_source', 'main-menu'))); $i = 1; foreach ($links as $key => $value) { if (is_numeric($key)) { $links[$key]['#attributes']['class'][] = 'color-' . $i; $i++; } } $output = _metroblocks_links($links); //$variables['attributes']['class'][] = 'right'; return '<ul' . drupal_attributes($variables['attributes']) . '>' . $output . '</ul>'; }
function bunsen_preprocess_page(&$variables) { drupal_add_library('system', 'ui.accordion'); // Primary nav. $variables['primary_nav'] = FALSE; if ($variables['main_menu']) { // Build links. $variables['primary_nav'] = menu_tree_output(menu_tree_all_data(variable_get('menu_main_links_source', 'main-menu'))); // Provide default theme wrapper function. $variables['primary_nav']['#theme_wrappers'] = array('menu_tree__primary'); } if (drupal_is_front_page()) { $variables['content_column_class'] = 'col-lg-12 text-center'; } else { $variables['content_column_class'] = 'col-lg-12 content-page'; } }
/** * Genereate navbar menu. */ function valghalla_bs_theme_navbarmenu($path) { $parent = menu_link_get_preferred($path); $parameters = array('active_trail' => array($parent['plid']), 'only_active_trail' => FALSE, 'min_depth' => $parent['depth'] + 1, 'max_depth' => $parent['depth'] + 1, 'conditions' => array('plid' => $parent['mlid'])); $children = menu_build_tree($parent['menu_name'], $parameters); $tree_output = menu_tree_output($children); $items = array(); foreach ($tree_output as $item_id => $item_data) { if (is_numeric($item_id) && is_array($item_data)) { $items[] = l($item_data['#title'], $item_data['#href'], array('attributes' => $item_data['#attributes'], 'html' => TRUE)); } } $menu = theme('item_list', array('items' => $items, 'type' => 'ul', 'attributes' => array('class' => 'dropdown-menu'))); $toggle = '<a href="#" class="dropdown-toggle" data-toggle="dropdown">' . $parent['link_title'] . ' <b class="caret"></b></a>'; if ($menu) { return $toggle . $menu; } }
function open_framework_preprocess_page(&$vars) { // Add page template suggestions based on the aliased path. For instance, if the current page has an alias of about/history/early, we'll have templates of: // page-about-history-early.tpl.php, page-about-history.tpl.php, page-about.tpl.php // Whichever is found first is the one that will be used. if (module_exists('path')) { $alias = drupal_get_path_alias(str_replace('/edit', '', $_GET['q'])); if ($alias != $_GET['q']) { $template_filename = 'page'; foreach (explode('/', $alias) as $path_part) { $template_filename = $template_filename . '-' . $path_part; $vars['template_files'][] = $template_filename; } } } // Get the entire main menu tree $main_menu_tree = menu_tree_all_data('main-menu'); // Add the rendered output to the $main_menu_expanded variables $vars['main_menu_expanded'] = menu_tree_output($main_menu_tree); // Primary nav $vars['primary_nav'] = FALSE; if ($vars['main_menu']) { // Build links $vars['primary_nav'] = menu_tree(variable_get('menu_main_links_source', 'main-menu')); // Provide default theme wrapper function $vars['primary_nav']['#theme_wrappers'] = array('menu_tree__primary'); } // Secondary nav $vars['secondary_nav'] = FALSE; if ($vars['secondary_menu']) { // Build links $vars['secondary_nav'] = menu_tree(variable_get('menu_secondary_links_source', 'user-menu')); // Provide default theme wrapper function $vars['secondary_nav']['#theme_wrappers'] = array('menu_tree__secondary'); } // Checks if tabs are set if (!isset($vars['tabs']['#primary'])) { $vars['tabs']['#primary'] = FALSE; } // Replace tabs with drop down version $vars['tabs']['#primary'] = _bootstrap_local_tasks($vars['tabs']['#primary']); // Add variable for site title $vars['my_site_title'] = variable_get('site_name'); }
/** * Implements hook_preprocess_region(). */ function openomega_preprocess_region(&$vars) { global $language; switch ($vars['region']) { // menu region case 'menu': $dropdown_menu = menu_tree_output(_openomega_menu_build_tree('main-menu', array('max_depth' => 2))); //set the active trail $active_trail = menu_get_active_trail(); foreach ($active_trail as $trail) { if (isset($trail['mlid']) && isset($dropdown_menu[$trail['mlid']])) { $dropdown_menu[$trail['mlid']]['#attributes']['class'][] = 'active-trail'; } } // Set the tab index for those with drop downs so can access the links. foreach ($dropdown_menu as $key => $item) { if (!empty($dropdown_menu[$key]['#below'])) { $dropdown_menu[$key]['#attributes']['tabindex'] = 0; } } $vars['dropdown_menu'] = $dropdown_menu; break; // default footer content // default footer content case 'footer_first': $footer_menu = menu_tree_output(_openomega_menu_build_tree('main-menu', array('max_depth' => 2))); //set the active trail $active_trail = menu_get_active_trail(); foreach ($active_trail as $trail) { if (isset($trail['mlid']) && isset($footer_menu[$trail['mlid']])) { $footer_menu[$trail['mlid']]['#attributes']['class'][] = 'active-trail'; } } $vars['footer_menu'] = $footer_menu; $vars['site_name'] = $site_name = variable_get('site_name'); $vars['footer_logo'] = l(theme('image', array('path' => drupal_get_path('theme', 'openomega') . "/logo-sm.png", 'alt' => "{$site_name} logo")), '', array("html" => TRUE, 'attributes' => array('class' => 'logo'))); if (function_exists('defaultcontent_get_node') && ($node = defaultcontent_get_node("email_update"))) { $node = node_view($node); $vars['subscribe_form'] = $node['webform']; } break; } }
/** * Implements template_preprocess_page(). */ function sizzle_preprocess_page(&$variables) { $theme_path = drupal_get_path('theme', 'sizzle'); // Add a menu link. $variables['menu_link'] = l(t('The Menu'), 'menus', array('attributes' => array('class' => array('btn')))); // Add a reservation link. $variables['reservation_link'] = ''; if (module_exists('restaurant_reservation')) { $variables['reservation_link'] = l(t('Book a Table'), 'reservation', array('attributes' => array('class' => array('btn')))); } // Add the footer menu to the template. $show_footer_nav = theme_get_setting('show_footer_nav'); if ($show_footer_nav) { $footer_nav_data = menu_build_tree('menu-footer-menu', array('min_depth' => 1, 'max_depth' => 2)); $variables['footer_nav'] = menu_tree_output($footer_nav_data); $variables['footer_nav']['#theme_wrappers'] = array(); } // Add the site background image. if ($site_background_image_fid = theme_get_setting('site_background_image')) { $site_background_image = file_load($site_background_image_fid); $site_background_image_url = file_create_url($site_background_image->uri); drupal_add_css('body { background-image: url("' . $site_background_image_url . '") }', array('type' => 'inline')); } // Add the footer background image. if ($footer_background_image_fid = theme_get_setting('footer_background_image')) { $footer_background_image = file_load($footer_background_image_fid); $footer_background_image_url = file_create_url($footer_background_image->uri); } else { $footer_background_image_url = '/' . $theme_path . '/assets/images/bg/bg-footer-default.jpg'; } drupal_add_css('.footer { background-image: url("' . $footer_background_image_url . '") }', array('type' => 'inline')); // Add copyright to theme. $copyright = theme_get_setting('copyright'); $variables['copyright'] = check_markup($copyright['value'], $copyright['format']); // Add footer text. $footer_text = theme_get_setting('footer_text'); $variables['footer_text'] = check_markup($footer_text['value'], $footer_text['format']); $variables['address'] = panopoly_config_get('address'); $variables['phone'] = panopoly_config_get('phone'); $variables['opening_hours'] = panopoly_config_get('opening_hours'); }
/** * @file * Contains theme override functions and preprocess functions for the theme. */ function subbluez_preprocess_page(&$vars) { $vars['main_menu_tree'] = menu_tree_output(menu_tree_all_data('main-menu')); $vars['slideshow_display'] = theme_get_setting('slideshow_display', 'subbluez'); $vars['footer_developed'] = theme_get_setting('footer_developed', 'subbluez'); //Columns $vars['col1'] = filter_xss_admin(theme_get_setting('colone', 'subbluez')); $vars['col1title'] = filter_xss_admin(theme_get_setting('colonetitle', 'subbluez')); $vars['col2'] = filter_xss_admin(theme_get_setting('coltwo', 'subbluez')); $vars['col2title'] = filter_xss_admin(theme_get_setting('coltwotitle', 'subbluez')); $vars['col3'] = filter_xss_admin(theme_get_setting('colthree', 'subbluez')); $vars['col3title'] = filter_xss_admin(theme_get_setting('colthreetitle', 'subbluez')); //Welcome $vars['wtitle'] = filter_xss_admin(theme_get_setting('welcome_title', 'subbluez')); $vars['wtext'] = filter_xss_admin(theme_get_setting('welcome_text', 'subbluez')); //Social $vars['twitter'] = theme_get_setting('twitter', 'subbluez'); $vars['facebook'] = theme_get_setting('facebook', 'subbluez'); $vars['linkedin'] = theme_get_setting('linkedin', 'subbluez'); $vars['theme_path_social'] = base_path() . drupal_get_path('theme', 'subbluez'); $vars['display'] = theme_get_setting('display', 'subbluez'); }
/** * Preprocessor for theme('page'). */ function apigee_devconnect_preprocess_page(&$variables) { $variables['user_reg_setting'] = variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL); $menu_tree = menu_tree_output(menu_tree_all_data('main-menu', NULL, 2)); $variables['primary_nav'] = drupal_render($menu_tree); // Custom Search $variables['search'] = FALSE; if (theme_get_setting('toggle_search') && module_exists('search')) { $variables['search'] = drupal_get_form('search_form'); } if (!user_is_anonymous()) { # Fix for long user names global $user; $user_email = $user->mail; if (strlen($user_email) > 22) { $tmp = str_split($user_email, 16); $user_email = $tmp[0] . '…'; } $variables['truncated_user_email'] = $user_email; } else { $variables['truncated_user_email'] = ''; } }
<?php $main_links = menu_tree_page_data(variable_get('menu_main_links_source', 'main-menu')); $main_links = menu_tree_output($main_links); $secondary_links = menu_tree_page_data(variable_get('menu_secondary_links_source', 'user-menu')); $secondary_links = menu_tree_output($secondary_links); ?> <div<?php print $attributes; ?> > <div<?php print $content_attributes; ?> > <?php if ($main_links) { ?> <nav class="navigation"> <?php print render($main_links); ?> </nav> <?php } ?> <?php if ($secondary_links) { ?> <nav class="navigation-secondary"> <?php
/** * Überschreibt das main-menu */ function aae_process_page(&$variables) { $menu_tree = menu_tree_all_data('main-menu'); $variables['main_menu'] = menu_tree_output($menu_tree); }
function hook_preprocess_page(&$variables) { $links_left = menu_tree_output(menu_tree_all_data(theme_plugin_get_setting('foundation_topbar', 'menu_left', 'main-menu'))); $links_right = menu_tree_output(menu_tree_all_data(theme_plugin_get_setting('foundation_topbar', 'menu_right', 'user-menu'))); $variables['foundation_topbar'] = theme('foundation_topbar', array('links_left' => $links_left, 'links_right' => $links_right)); }
"> <img src="<?php print $logo; ?> " alt="<?php print t('Home'); ?> " /> </a> <?php } ?> <div class="nav-collapse"> <nav role="navigation"> <?php $menu_tree = menu_tree_output(menu_tree_all_data('main-menu', NULL, 2)); print drupal_render($menu_tree); ?> <div id="login-buttons" class="span7 pull-right"> <ul class="nav pull-right"> <?php if ($user->uid == 0) { ?> <!-- show/hide login and register links depending on site registration settings --> <?php if ($user_reg_setting != 0 || $user->uid == 1) { ?> <li class="<?php echo $current_path == "user/register" ? "active" : ""; ?> "><?php
/** function open_omega_system_themes_page_alter(&$theme_groups) { $hidden = array( 'alpha', 'omega', ); foreach ($theme_groups as $state => &$group) { if ($state == 'disabled') { foreach ($theme_groups[$state] as $id => &$theme) { if (in_array($theme, $hidden)) { unset($theme_groups[$state][$id]); } } } } } */ function agency_1_preprocess_region(&$vars) { global $language; switch ($vars['region']) { // menu region case 'menu': $footer_menu_cache = cache_get("footer_menu_data:" . $language->language); if ($footer_menu_cache) { $footer_menu = $footer_menu_cache->data; } else { $footer_menu = menu_tree_output(_agency_1_menu_build_tree('main-menu', array('max_depth' => 2))); cache_set("footer_menu_data:" . $language->language, $footer_menu); } //set the active trail $active_trail = menu_get_active_trail(); foreach ($active_trail as $trail) { if (isset($trail['mlid']) && isset($footer_menu[$trail['mlid']])) { $footer_menu[$trail['mlid']]['#attributes']['class'][] = 'active-trail'; } } $vars['dropdown_menu'] = $footer_menu; break; // default footer content // default footer content case 'footer_first': $footer_menu_cache = cache_get("footer_menu_data:" . $language->language); if ($footer_menu_cache) { $footer_menu = $footer_menu_cache->data; } else { $footer_menu = menu_tree_output(_agency_1_menu_build_tree('main-menu', array('max_depth' => 2))); cache_set("footer_menu_data", $footer_menu); } //set the active trail $active_trail = menu_get_active_trail(); foreach ($active_trail as $trail) { if (isset($trail['mlid']) && isset($footer_menu[$trail['mlid']])) { $footer_menu[$trail['mlid']]['#attributes']['class'][] = 'active-trail'; } } $vars['footer_menu'] = $footer_menu; $vars['site_name'] = $site_name = variable_get('site_name'); $vars['footer_logo'] = l(theme('image', array('path' => drupal_get_path('theme', 'agency_1') . "/logo-sm.png", 'alt' => "{$site_name} logo")), '', array("html" => TRUE, 'attributes' => array('class' => 'logo'))); //Branding $vars['display_footer_branding'] = theme_get_setting('display_footer_branding'); //Contact Us Block $vars['display_footer_contact'] = theme_get_setting('display_footer_contact'); $vars['footer_contact_us_title'] = theme_get_setting('footer_contact_us_title'); $vars['footer_contact_us_agency_title'] = theme_get_setting('footer_contact_us_agency_title'); $vars['footer_contact_us_address_1'] = theme_get_setting('footer_contact_us_address_1'); $vars['footer_contact_us_address_2'] = theme_get_setting('footer_contact_us_address_2'); $vars['footer_contact_us_phone'] = theme_get_setting('footer_contact_us_phone'); $vars['footer_contact_us_fax'] = theme_get_setting('footer_contact_us_fax'); $vars['footer_contact_us_map_link'] = theme_get_setting('footer_contact_us_map_link'); $vars['footer_contact_us_map_image'] = theme_get_setting('footer_contact_us_map_image'); $vars['footer_contact_us_title_link'] = theme_get_setting('footer_contact_us_title_link'); $vars['footer_contact_us_map_path'] = theme_get_setting('footer_contact_us_map_path'); if (function_exists('defaultcontent_get_node') && ($node = defaultcontent_get_node("email_update"))) { $node = node_view($node); $vars['subscribe_form'] = $node['webform']; } //krumo($vars['footer_menu']); break; } }
} ?> <?php if (isset($dribbble)) { ?> <a href="<?php print $dribbble; ?> " target="_blank"><i class="icon-dribbble icon-2x"></i></a><?php } ?> </div> --> <?php $mtree = menu_tree_all_data('user-menu'); $mtree_out = menu_tree_output($mtree); print drupal_render($mtree_out); ?> <?php if ($page['search']) { ?> <?php if (theme_get_setting('header_style') == 'header2' || theme_get_setting('header_style') == 'header3') { ?> <?php print render($page['search']); ?> <?php } ?>
/** * 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; }
/** * 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'); }