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'); }
/** * Preprocess variables for page.tpl.php * * @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['columns'] = 3; } elseif (!empty($variables['page']['sidebar_first'])) { $variables['columns'] = 2; } elseif (!empty($variables['page']['sidebar_second'])) { $variables['columns'] = 2; } else { $variables['columns'] = 1; } // 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'); } // Replace tabs with drop down version $variables['tabs']['#primary'] = _bootstrap_local_tasks($variables['tabs']['#primary']); }
function SFT_preprocess_page(&$vars) { // Bootstrap 2.3.1 drupal_add_css(drupal_get_path('theme', 'open_framework') . '/packages/bootstrap-2.3.1/css/bootstrap.min.css', array('group' => CSS_DEFAULT, 'media' => 'all', 'weight' => 10, 'preprocess' => TRUE)); drupal_add_css(drupal_get_path('theme', 'open_framework') . '/packages/bootstrap-2.3.1/css/bootstrap-responsive.min.css', array('group' => CSS_DEFAULT, 'media' => 'all', 'weight' => 15, 'preprocess' => TRUE)); drupal_add_js(drupal_get_path('theme', 'open_framework') . '/packages/bootstrap-2.3.1/js/bootstrap.min.js', array('group' => JS_DEFAULT, 'weight' => 10, 'preprocess' => TRUE)); // Font Awesome version selection $font_awesome_version = theme_get_setting('font_awesome_version'); if ($font_awesome_version == 'font-awesome-3') { drupal_add_css(drupal_get_path('theme', 'open_framework') . '/packages/font-awesome-3.2.1/css/font-awesome.min.css', array('group' => CSS_DEFAULT, 'media' => 'all', 'weight' => 20, 'preprocess' => TRUE)); } if ($font_awesome_version == 'font-awesome-4') { drupal_add_css(drupal_get_path('theme', 'open_framework') . '/packages/font-awesome-4.3.0/css/font-awesome.min.css', array('group' => CSS_DEFAULT, 'media' => 'all', 'weight' => 20, 'preprocess' => TRUE)); } // 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'); }