/** * Override or insert variables into the page template. */ function responsive_green_preprocess_page(&$vars) { if (isset($vars['main_menu'])) { $vars['main_menu'] = theme('links__system_main_menu', array('links' => $vars['main_menu'], 'attributes' => array('class' => array('links', 'main-menu', 'clearfix')), 'heading' => array('text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible')))); } else { $vars['main_menu'] = FALSE; } if (isset($vars['secondary_menu'])) { $vars['secondary_menu'] = theme('links__system_secondary_menu', array('links' => $vars['secondary_menu'], 'attributes' => array('class' => array('links', 'secondary-menu', 'clearfix')), 'heading' => array('text' => t('Secondary menu'), 'level' => 'h2', 'class' => array('element-invisible')))); } else { $vars['secondary_menu'] = FALSE; } if (module_exists('i18n_menu')) { $vars['main_menu_tree'] = i18n_menu_translated_tree(variable_get('menu_main_links_source', 'main-menu')); } else { $vars['main_menu_tree'] = menu_tree(variable_get('menu_main_links_source', 'main-menu')); } $vars['twitter'] = theme_get_setting('twitter', 'responsive_green'); $vars['facebook'] = theme_get_setting('facebook', 'responsive_green'); $vars['googleplus'] = theme_get_setting('googleplus', 'responsive_green'); $vars['linkedin'] = theme_get_setting('linkedin', 'responsive_green'); $vars['theme_path_social'] = base_path() . drupal_get_path('theme', 'responsive_green'); $vars['display'] = theme_get_setting('display', 'responsive_green'); $vars['sdisplay'] = theme_get_setting('sdisplay', 'responsive_green'); $vars['img1'] = base_path() . drupal_get_path('theme', 'responsive_green') . '/images/slide-image-1.jpg'; $vars['img2'] = base_path() . drupal_get_path('theme', 'responsive_green') . '/images/slide-image-2.jpg'; $vars['img3'] = base_path() . drupal_get_path('theme', 'responsive_green') . '/images/slide-image-3.jpg'; }
function unity_lab_links__system_main_menu($vars) { $menu_name = variable_get('menu_main_links_source', 'main-menu'); $tree = menu_tree($menu_name); $html = drupal_render($tree); return $html; }
/** * Implements partial__{name}_preprocess(). */ function partial__homepage_preprocess(&$variables) { // Not using Tableau for now // drupal_add_js('https://public.tableau.com/javascripts/api/viz_v1.js', 'external'); $homepage_menu = menu_tree('menu-homepage'); $variables['homepage_menu'] = render($homepage_menu); }
function _myu_user_dropdown() { global $user; global $language; $items = array(); if ($user->uid === 0) { $login_link = l('<span>' . t('Login') . '</span>', '', array('attributes' => array('class' => 'login dropdown-toggle', 'data-toggle' => 'modal'), 'fragment' => 'login', 'external' => TRUE, 'html' => TRUE)); return '<ul class="menu nav navbar-nav user"><li class="dropdown dropdown-user">' . $login_link . '</li></ul>'; } else { $username = ''; if (!empty($user->picture)) { $fid = $user->picture; $file = file_load($fid); $username = theme('image_style', array('path' => $file->uri, 'style_name' => '29x29', 'attributes' => array('class' => 'img-circle'))); } $username .= '<span class="username username-hide-on-mobile">' . format_username($GLOBALS['user']) . '</span><i class="fa fa-angle-down"></i>'; $username_link = l($username, 'javascript:;', array('html' => TRUE, 'language' => $language, 'external' => TRUE, 'attributes' => array('class' => 'dropdown-toggle', 'data-close-others' => 'true', 'data-hover' => 'dropdown', 'data-toggle' => 'dropdown'))); $user_menu = menu_tree('user-menu'); foreach ($user_menu as $menu_link) { if (isset($menu_link['#original_link'])) { $items[] = l($menu_link['#original_link']['title'], $menu_link['#original_link']['href'], array('language' => $language)); } } $user_menu_list = theme('item_list', array('items' => $items, 'type' => 'ul', 'attributes' => array('class' => 'dropdown-menu dropdown-menu-default'))); return '<ul class="menu nav navbar-nav user"><li class="dropdown dropdown-user">' . $username_link . $user_menu_list . '</li></ul>'; } }
function deco_preprocess_page(&$vars) { $vars['sidebar_triple'] = FALSE; if (!empty($vars['page']['sidebar_second']) && !empty($vars['page']['sidebar_right_sec']) && !empty($vars['page']['sidebar_first'])) { $vars['classes_array'][] .= ' sidebar-triple'; $vars['sidebar_triple'] = TRUE; } if (!empty($vars['page']['sidebar_right_sec']) && empty($vars['page']['sidebar_second'])) { $vars['page']['sidebar_second'] = $vars['page']['sidebar_right_sec']; $vars['page']['sidebar_right_sec'] = ''; } // set variables for the logo and slogan $site_fields = array(); if ($vars['site_name']) { $site_fields[] = check_plain($vars['site_name']); } if ($vars['site_slogan']) { $site_fields[] = '- ' . check_plain($vars['site_slogan']); } $vars['site_title'] = implode(' ', $site_fields); if (isset($site_fields[0])) { $site_fields[0] = '<span class="site-name">' . $site_fields[0] . '</span>'; } if (isset($site_fields[1])) { $site_fields[1] = '<span class="site-slogan">' . $site_fields[1] . '</span>'; } $vars['site_title_html'] = implode(' ', $site_fields); $vars['primary_menu'] = str_replace('class="menu"', 'class="links primary-links"', render(menu_tree(variable_get('menu_main_links_source', 'main-menu')))); $vars['secondary_menu'] = str_replace('class="menu"', 'class="links secondary-links"', render(menu_tree(variable_get('menu_secondary_links_source', 'secondary-menu')))); }
function sky_preprocess_page(&$variables, $hook) { // Add a page title variable using the site slogan on the front page if (theme_get_setting('sky_title')) { if ($variables['is_front'] && !is_null(variable_get('site_name', ''))) { $variables['sky_title'] = variable_get('site_name', ''); } else { $variables['sky_title'] = drupal_get_title(); } } // Add a transparent spacer image to the end of the footer message $variables['footer_message'] .= theme('image', path_to_theme() . '/images/transparent.gif', 'spacer', 'spacer', array('style' => 'height:2em;')); // How is the navigation aligned $navigation_alignment = theme_get_setting('sky_nav_alignment'); // Prepare the menu markup for the Primary Links (make it a menu tree) if ($variables['primary_links']) { $pid = variable_get('menu_primary_links_source', 'primary-links'); $tree = menu_tree($pid); $variables['primary_links'] = '<del class="wrap-' . $navigation_alignment . '">' . $tree . '</del>'; } // Include advanced theme classes. if (theme_get_setting('sky_themer_classes') == 1) { include 'theme-classes.php'; $variables['body_tag'] = '<body' . $variables['body_css'] . '>'; } else { $variables['body_tag'] = '<body class="' . $variables['layout'] . '">'; } }
function espresso_preprocess_html(&$variables) { module_load_include('inc', 'designssquare_lib', 'includes/template_api'); //for header tapi module_load_include('module', 'designssquare_lib'); //for menu block $reqUrl = $_GET['q']; //header menu $variables['primary_nav'] = menu_tree(variable_get('menu_main_links_source', 'main-menu')); //footer menu $variables['bottom_nav'] = menu_tree('menu-bottom-menu'); $variables['bottom_nav']['#theme_wrappers'] = array('menu_tree__bottom'); // _default_css(); // _default_js(); if (arg(0) == 'node' && is_numeric(arg(1)) && ($node = node_load(arg(1)))) { // $widget = 'field_widgets'; // $widget_list = field_get_items('node', $node, 'field_widgets'); // (is_array($widget_list) && count($widget_list)) ? _add_widgets($widget_list, $node) : ''; } $variables['head_tapi'] = _header_tapi_site($variables); //remove classes from body tag $variables['classes_array'] = array(); //making regions available in html scope include_blocks($variables, 'html'); //make contact template api available // $variables['contact_tapi'] = _contact_tapi(); //retrieve header and background images // $variables['header_img'] = _header_img(); // $variables['background_img'] = _background_img(); //Custom Theme Settings $variables['espresso_bg_img'] = _background_img(); // $variables['espresso_bg_img'] = variable_get('ds_theme_predefined_background',theme_get_setting('ds_theme_predefined_background')).'.jpg'; //adding styles drupal_add_css(path_to_theme() . '/assets/css/custom.css', array('group' => CSS_THEME + 2, 'type' => 'file')); }
/** * Return a cascade primary links. * Clone implementation from user_block(). * * @return * a themed cascade primary links. */ function phptemplate_primary() { $output = '<div id="primary-links-region">'; $output .= menu_tree(variable_get('menu_primary_links_source', 'primary-links')); $output .= '</div>'; return $output; }
/** * Implementation of preprocess_page(). */ function nub_core_preprocess_page(&$vars) { $html_attr = array(); $html_attr['lang'] = $vars['language']->language; $html_attr['dir'] = $vars['language']->dir; $vars['html_attr'] = array_filter($html_attr); $body_attr = array(); $body_attr['class'] = $vars['body_classes']; $vars['body_attr'] = array_filter($body_attr); // Theme primary and secondary menu. $vars['primary_links'] = !empty($vars['primary_links']) ? menu_tree(variable_get('menu_primary_links_source', 'primary-links')) : ""; $vars['secondary_links'] = !empty($vars['secondary_links']) ? theme('links', $vars['secondary_links'], array('class' => 'menu')) : ""; // Split primary and secondary local tasks $vars['tabs_primary'] = theme('menu_local_tasks', 'primary'); $vars['tabs_secondary'] = theme('menu_local_tasks', 'secondary'); // Branding $logo_path = ltrim($vars['logo'], '/'); $vars['logo_linked'] = file_exists($logo_path) ? l(theme('image', $logo_path, $vars['site_name'] . ' logo'), '<front>', array('html' => TRUE, 'attributes' => array('class' => 'site-logo', 'title' => 'Back to home'))) : ''; $vars['site_name_linked'] = l($vars['site_name'], '<front>', array('attributes' => array('title' => 'Back to home'))); // Skip navigation links (508). $vars['skip_nav'] = '<a id="skip-nav" class="anchorLink" href="#main">' . t('Skip navigation') . '</a>'; // Back to top. $vars['back_to_top'] = '<a id="back-to-top" class="anchorLink" href="#header">' . t('↑ Back to top') . '</a>'; // Copyright text $vars['copyright'] = "© " . date("Y") . " " . $vars['site_name'] . '.'; // Remove duplicate content-type header -- see http://drupal.org/node/451304 $vars['head'] = drupal_set_html_head(); }
function iha_preprocess_page(&$variables) { $search_box = drupal_render(drupal_get_form('search_form')); $variables['search_box'] = $search_box; if (drupal_is_front_page()) { unset($variables['page']['content']['system_main']['default_message']); //will remove message "no front page content is created" drupal_set_title(''); //removes welcome message (page title) } if (arg(0) == 'node') { $variables['node_content'] =& $variables['page']['content']['system_main']['nodes'][arg(1)]; } if (isset($variables['node']->type)) { $variables['theme_hook_suggestions'][] = 'page__' . $variables['node']->type; } // Prepare the mobile menu. $user_menu = menu_tree('user-menu'); $main_menu = menu_tree('main-menu'); $menu_tree = array_merge($main_menu, $user_menu); // FYI for future dev's - If need to add more menu items, then load the other menu through menu tree as well and do a // array merge or for loop to attach the items to the $menu_tree. $mobile_menu = '<ul class="list-unstyled main-menu">'; foreach ($menu_tree as $mlid => $mm) { if (is_int($mlid)) { $mobile_menu .= iha_render_mobile_menu($mm); } } $mobile_menu .= '</ul>'; $variables['mobile_menu'] = $mobile_menu; }
/** * Return a full tree of the expanded menu. Thank you multiflex-3 for this code! */ function arthemia_primary() { $output = '<div id="page-bar">'; $output .= menu_tree(variable_get('menu_primary_links_source', 'primary-links')); $output .= '</div>'; return $output; }
/** * Preprocess Page */ function superhero_preprocess_page(&$vars) { $theme = superhero_get_theme(); $theme->page =& $vars; $vars['attributes_array']['class'] = array('body'); // 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'); } $default_preset = $theme->settings['default_preset']; $force = false; $superhero_base_url = variable_get('superhero_base_url', ''); global $base_url; if ($superhero_base_url != $base_url) { $force = true; } variable_set('superhero_base_url', $base_url); require_once dirname(__FILE__) . '/includes/superhero_scss.php'; $scss = new Superhero_scss($theme); if (!file_exists('public://css')) { drupal_mkdir('public://css'); } $file = $scss->outputFile('public://css/' . $theme->theme . '-theme-preset' . ($default_preset + 1) . '.css', $force); drupal_add_css($file, array('type' => 'file', 'group' => CSS_THEME)); }
/** * Implementation of hook_preprocess_page(). */ function stability_process_page(&$variables) { global $user; $variables['login_account_links'] = ''; if (theme_get_setting('login_account_links') || module_exists('uc_cart')) { $output = ''; if (theme_get_setting('login_account_links')) { $output .= '<span class="login"> <i class="fa fa-lock"></i> ' . l($user->uid ? t('My Account') : t('Login'), 'user') . ' </span>'; $output .= $user->uid ? '<span class="logout"><i class="fa fa-sign-out"></i> ' . l(t('Logout'), 'user/logout') . '</span>' : ''; $output .= !$user->uid ? '<span class="register"><i class="fa fa-pencil-square-o"></i>' . t('Not a Member?') . ' ' . l(t('Register'), 'user/register') . '</span>' : ''; } if (module_exists('uc_cart')) { $output .= '<span class="cart"> <i class="fa fa-shopping-cart"></i> ' . l(t('Shopping Cart'), 'cart') . ' </span>'; } $variables['login_account_links'] = ' <div class="header-top-right"> ' . $output . ' </div>'; } $header_top_menu_tree = module_exists('i18n_menu') ? i18n_menu_translated_tree('menu-header-top-menu') : menu_tree('menu-header-top-menu'); $variables['header_top_menu_tree'] = drupal_render($header_top_menu_tree); // Process Slideshow Sub Header if (theme_get_setting('sub_header') == 5 || arg(2) == 'sub-header' && arg(3) == '5') { drupal_add_js(drupal_get_path('theme', 'stability') . '/vendor/jquery.glide.min.js'); } if (theme_get_setting('retina')) { drupal_add_js(drupal_get_path('theme', 'stability') . '/vendor/jquery.retina.js'); } drupal_add_js(array('stability' => array('flickr_id' => theme_get_setting('flickr_id'), 'logo_sticky' => theme_get_setting('logo_sticky'))), 'setting'); }
/** Draw menu. */ function k373k_links($variables) { if (array_key_exists('id', $variables['attributes']) && $variables['attributes']['id'] == 'main-menu-links') { $pid = variable_get('menu_main_links_source', 'main-menu'); $tree = menu_tree($pid); return drupal_render($tree); } return theme_links($variables); }
/** * Implements theme_links(). */ function solsud_links($variables) { if (array_key_exists('id', $variables['attributes']) && $variables['attributes']['id'] == 'main-menu-links') { $tree = menu_tree('main-menu'); return drupal_render($tree); } return theme_links($variables); }
function bartik_plus_links($variables) { if (array_key_exists('id', $variables['attributes']) && $variables['attributes']['id'] == 'main-menu-links') { $pid = variable_get('menu_main_links_source', 'main-menu'); $tree = menu_tree($pid); return '<div id="main-menu-links">' . drupal_render($tree) . "</div>"; } return theme_links($variables); }
public function menu() { $parent_id = $_REQUEST['parent_id'] ? $_REQUEST['parent_id'] : 0; $group_id = $_REQUEST['group_id'] ? "{$_REQUEST['group_id']}" : ''; $tree = menu_tree($parent_id, $group_id); $tree = '<ul id="browser" class="filetree">' . $tree . '</ul>'; $this->assign('menu_tree', $tree); $this->display(); }
/** * Implements theme_links(). */ function glossy_links($vars) { // Add superfish dropdowns effect to main menu if (array_key_exists('id', $vars['attributes']) && $vars['attributes']['id'] == 'main-menu' && variable_get('dh_display_menu_tree', true)) { $pid = variable_get('menu_main_links_source', 'main-menu'); $tree = menu_tree($pid); $output = drupal_render($tree); $output = '<div class="superfish">' .$output. '</div>'; return preg_replace('/<ul class="menu/i', '<ul class="main-menu clearfix', $output, 1); } return theme_links($vars); }
function micah_preprocess_page(&$vars, $hook) { //get all menu's $menus = array(); $menus = menu_get_menus($all = TRUE); //create var for every menu so we can use it in our page.tpl.php foreach ($menus as $key => $value) { $var = str_replace('-', '_', $key); $vars[$var] = menu_tree($key); } // $vars['header_image'] = file_create_url($vars['node']->field_image['und'][0]['uri']); }
/** * Pre-processes variables for the "page" theme hook. * * See template for list of available variables. * * @see page.tpl.php * * @ingroup theme_preprocess */ function walk_preprocess_page(&$vars) { // Add information about the number of sidebars. if (!empty($vars['page']['sidebar_first']) && !empty($vars['page']['sidebar_second'])) { $vars['content_column_class'] = ' class="col-sm-6"'; } elseif (!empty($vars['page']['sidebar_first']) || !empty($vars['page']['sidebar_second'])) { $vars['content_column_class'] = ' class="col-sm-9"'; } else { $vars['content_column_class'] = ' class="col-sm-12"'; } if (bootstrap_setting('fluid_container') == 1) { $vars['container_class'] = 'container-fluid'; } else { $vars['container_class'] = 'container'; } // 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'); } $vars['navbar_classes_array'] = array('navbar'); if (bootstrap_setting('navbar_position') !== '') { $vars['navbar_classes_array'][] = 'navbar-' . bootstrap_setting('navbar_position'); } elseif (bootstrap_setting('fluid_container') == 1) { $vars['navbar_classes_array'][] = 'container-fluid'; } else { $vars['navbar_classes_array'][] = 'container'; } if (bootstrap_setting('navbar_inverse')) { $vars['navbar_classes_array'][] = 'navbar-inverse'; } else { $vars['navbar_classes_array'][] = 'navbar-default'; } if (arg(0) == 'node' && arg(1) == 'add' && arg(2) == 'walk') { drupal_set_title('Hosting a Walk'); } if (isset($vars['node']) && $vars['node']->nid == 12) { //dpm($vars); hide($vars['page']['content']['system_main']['nodes']); } }
/** * Implements hook_preprocess_page(). * * @see page.tpl.php */ function tradjenta_preprocess_page(&$variables) { // Footer nav. // Build links. $variables['footer_nav'] = menu_tree('menu-footer-menu'); // Provide default theme wrapper function. $variables['footer_nav']['#theme_wrappers'] = array('menu_tree__footer'); // Secondary nav. // Build links. $variables['sec_nav'] = menu_tree('menu-secondary-menu'); // Provide default theme wrapper function. $variables['sec_nav']['#theme_wrappers'] = array('menu_tree__secondary_menu'); }
/** * Implementation of hook_preprocess_HOOK * * @param array $vars */ function hcpss_schoolsite_theme_preprocess_page(&$vars) { $vars['facebook_url'] = variable_get('hcpss_school_facebook_url'); $vars['hcpss_school_code'] = variable_get('hcpss_school_code', 'generic'); // Add a fully expanded version of the main menu to the page template and call // it $primary_nav. $vars['primary_nav'] = FALSE; if ($vars['main_menu']) { $primary_nav = menu_tree(variable_get('menu_main_links_source', 'main-menu')); $primary_nav['#theme_wrappers'] = array('menu_tree__primary'); $vars['primary_nav'] = $primary_nav; } }
/** * Implements template_preprocess_page(). */ function radix_stanley_preprocess_page(&$variables) { // 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__navbar_right'); // Add copyright to theme. if ($copyright = theme_get_setting('copyright')) { $variables['copyright'] = check_markup($copyright['value'], $copyright['format']); } // Use a different template per content type. if (isset($variables['node'])) { $variables['theme_hook_suggestions'][] = 'page__' . $variables['node']->type; } }
/** * Override or insert PHPTemplate variables into the templates. */ function phptemplate_preprocess_page(&$vars) { $vars['tabs2'] = menu_secondary_local_tasks(); // Hook into color.module if (module_exists('color')) { _color_page_alter($vars); } $vars['celebrity_search'] = drupal_get_form('search_celebrity'); // Generate menu tree from source of primary links $vars['primary_links_tree'] = menu_tree(variable_get('menu_primary_links_source', 'primary-links')); }
/** * Implements hook_preprocess_page(). */ function reset_preprocess_page(&$variables) { // Remove feed icon according to theme setting. if (!theme_get_setting('feed_icon')) { $variables['feed_icons'] = ''; } // Remove breadcrumb according to theme setting. if (!theme_get_setting('breadcrumb')) { $variables['breadcrumb'] = ''; } if (!$variables['tabs']['#primary']) { $variables['tabs'] = ''; } $variables['main_menu'] = theme_get_setting('toggle_main_menu') ? menu_tree(variable_get('menu_main_links_source', 'main-menu')) : ''; $variables['secondary_menu'] = theme_get_setting('toggle_secondary_menu') ? menu_tree(variable_get('menu_secondary_links_source', 'user-menu')) : ''; }
/** * Override or insert variables into the page template. * * @param $vars * An array of variables to pass to the theme template. */ function jbase_preprocess_page(&$vars) { // Add preface, postscript, & footers classes with number of active sub-regions $region_list = array('prefaces' => array('preface_first', 'preface_second', 'preface_third'), 'postscripts' => array('postscript_first', 'postscript_second', 'postscript_third'), 'footers' => array('footer_first', 'footer_second', 'footer_third')); foreach ($region_list as $sub_region_key => $sub_region_list) { $active_regions = array(); foreach ($sub_region_list as $region_item) { if (!empty($vars['page'][$region_item])) { $active_regions[] = $vars['page'][$region_item]; } } $vars[$sub_region_key] = $sub_region_key . '-' . strval(count($active_regions)); } // Render menu tree from main-menu $menu_tree = menu_tree('main-menu'); $vars['main_menu_tree'] = render($menu_tree); }
/** * 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'); } }
/** * Pre-processes variables for the "page" theme hook. * * See template for list of available variables. * * @see page.tpl.php * * @ingroup theme_preprocess */ function angole_preprocess_page(&$variables) { // Add information about the number of sidebars. if (!empty($variables['page']['sidebar_first']) && !empty($variables['page']['sidebar_second'])) { $variables['content_column_class'] = ' class="col-lg-6"'; } elseif (!empty($variables['page']['sidebar_first']) || !empty($variables['page']['sidebar_second'])) { $variables['content_column_class'] = ' class="col-lg-9"'; } else { $variables['content_column_class'] = ' class="col-lg-12"'; } if (bootstrap_setting('fluid_container') == 1) { $variables['container_class'] = 'container-fluid'; } else { $variables['container_class'] = 'container'; } // Primary nav. $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'); } $variables['navbar_classes_array'] = array('navbar'); if (bootstrap_setting('navbar_position') !== '') { $variables['navbar_classes_array'][] = 'navbar-' . bootstrap_setting('navbar_position'); } elseif (bootstrap_setting('fluid_container') == 1) { $variables['navbar_classes_array'][] = 'container-fluid'; } else { $variables['navbar_classes_array'][] = 'container'; } if (bootstrap_setting('navbar_inverse')) { $variables['navbar_classes_array'][] = 'navbar-inverse'; } else { $variables['navbar_classes_array'][] = 'navbar-default'; } }
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_page(). * * @see page.tpl.php */ function bootstrap_preprocess_page(&$variables) { // 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'] = ' class="col-sm-12"'; } // Primary nav. $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'); } $variables['navbar_classes_array'] = array('navbar'); if (theme_get_setting('bootstrap_navbar_position') !== '') { $variables['navbar_classes_array'][] = 'navbar-' . theme_get_setting('bootstrap_navbar_position'); } else { $variables['navbar_classes_array'][] = 'container'; } if (theme_get_setting('bootstrap_navbar_inverse')) { $variables['navbar_classes_array'][] = 'navbar-inverse'; } else { $variables['navbar_classes_array'][] = 'navbar-default'; } if (arg(0) == 'node') { if (isset($variables['node'])) { $node = $variables['node']; $variables['theme_hook_suggestions'][] = 'page__' . $node->type; } } }