/** * Override or insert variables into the page template. */ function seven_preprocess_page(&$vars) { $vars['primary_local_tasks'] = menu_primary_local_tasks(); $vars['secondary_local_tasks'] = menu_secondary_local_tasks(); $vars['ie_styles'] = '<!--[if lt IE 7]><style type="text/css" media="screen">@import ' . path_to_theme() . '/ie6.css";</style><![endif]-->'; $vars['back_to_site'] = l(t('Back to the front page'), ''); }
/** * Preprocessor for theme('page'). */ function cube_preprocess_page(&$vars) { // Automatically adjust layout for page with right sidebar content if no // explicit layout has been set. $layout = module_exists('context_layouts') ? context_layouts_get_active_layout() : NULL; if (arg(0) != 'admin' && !empty($vars['page']['right']) && (!$layout || $layout['layout'] == 'default')) { $vars['theme_hook_suggestion'] = 'page__context_layouts_cube_columns'; drupal_add_css(drupal_get_path('theme', 'cube') . '/layout-sidebar.css'); } // Clear out help text if empty. if (empty($vars['help']) || !strip_tags($vars['help'])) { $vars['help'] = ''; } // Help text toggler link. $vars['help_toggler'] = l(t('Help'), $_GET['q'], array('attributes' => array('id' => 'help-toggler', 'class' => array('toggler')), 'fragment' => 'help-text')); // Overlay is enabled. $vars['overlay'] = module_exists('overlay') && overlay_get_mode() === 'child'; if ($vars['overlay']) { } // Display user links $vars['user_links'] = _cube_user_links(); // Display tabs $vars['primary_tabs'] = menu_primary_local_tasks(); $vars['secondary_tabs'] = menu_secondary_local_tasks(); }
/** * Returns renderable local tasks. * * @ingroup themeable */ function busy_menu_local_tasks() { $output = array(); if ($primary = menu_primary_local_tasks()) { foreach ($primary as $key => $task) { if (is_numeric($key) && $key == count($primary) - 1) { $primary[$key]['#last'] = TRUE; } } $primary['#prefix'] = '<ul class="tabs primary">'; $primary['#suffix'] = '</ul>'; $output[] = $primary; } if ($secondary = menu_secondary_local_tasks()) { foreach ($secondary as $key => $task) { if (is_numeric($key) && $key == count($secondary) - 1) { $secondary[$key]['#last'] = TRUE; } } $secondary['#prefix'] = '<ul class="tabs secondary">'; $secondary['#suffix'] = '</ul>'; $output[] = $secondary; } return $output; }
/** * Implementation of preprocess_page(). */ function tao_preprocess_page(&$vars) { // Split primary and secondary local tasks $vars['primary_local_tasks'] = menu_primary_local_tasks(); $vars['secondary_local_tasks'] = menu_secondary_local_tasks(); // Link site name to frontpage $vars['site_name'] = l($vars['site_name'], '<front>'); }
/** * Returns the rendered local tasks. The default implementation renders * them as tabs. * * @ingroup themeable */ function phptemplate_menu_local_tasks() { $output = ''; if ($primary = menu_primary_local_tasks()) { $output .= "<ul class=\"tabs primary\">\n" . $primary . "</ul>\n"; } return $output; }
/** * Implements hook_preprocess_node(). * * Enable template suggestions for teaser ex. node--conent-type--teaser.tpl.php. */ function bootsmacss_preprocess_node(&$vars) { if ($vars['view_mode'] == 'teaser') { array_unshift($vars['theme_hook_suggestions'], 'node__' . $vars['node']->type . '__teaser'); array_unshift($vars['theme_hook_suggestions'], 'node__' . $vars['node']->nid . '__teaser'); } // Prepare tabs to render them in node.tpl or DS layout instead of page.tpl. $vars['tabs'] = menu_primary_local_tasks(); }
/** * Implements hook_preprocess_page(). */ function vdb_preprocess_page(&$vars) { $menu1 = menu_navigation_links('main-menu', 0); $vars['menu_first'] = theme('links__system_main_menu', array('links' => $menu1, 'attributes' => array('id' => 'main-menu-links'))); $menu2 = menu_navigation_links('main-menu', 1); $vars['menu_second'] = empty($menu2) ? '' : theme('links__system_main_menu', array('links' => $menu2, 'preserve_query' => TRUE, 'attributes' => array('class' => array('tabs', 'primary')))); $vars['tabs_first'] = menu_primary_local_tasks(); $vars['tabs_second'] = menu_secondary_local_tasks(); }
/** * Returns the rendered local tasks. The default implementation renders * them as tabs. Overridden to split the secondary tasks. * * @ingroup themeable */ function cp_theme_menu_local_tasks() { $output = ''; $primary = menu_primary_local_tasks(); if ($primary) { $output .= '<ul class="tabs primary clear-block">' . $primary . '</ul>'; } return $output; }
/** * Override or insert PHPTemplate variables into the templates. */ function phptemplate_preprocess_page(&$vars) { $view = get_artx_drupal_view(); $message = $view->get_incorrect_version_message(); if (!empty($message)) { drupal_set_message($message, 'error'); } $vars['tabs'] = menu_primary_local_tasks(); $vars['tabs2'] = menu_secondary_local_tasks(); }
/** * Implements template_preprocess_html(). * * The changes made in this function affect the variables for the html.tpl.php * template file, which is located in templates/html.tpl.php of this theme. * Using drupal_css_css() is covered on pages 344-345. */ function dgd7_preprocess_html(&$vars) { // Unfortunately, the XHTML+RDFa 1.0 doctype is hardcoded. We don't want an // XHMTL doctype and the RDFa version is old. The following code changes it // to HTML+RDFa 1.1 when the RDF module is enabled, and a plain jane HTML5 // doctype when it's not. To learn more about theming with RDFa in Drupal 7 // see http://lin-clark.com/blog/theming-html5-and-rdfa-drupal-7 if (module_exists('rdf')) { $vars['doctype'] = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML+RDFa 1.1//EN">' . "\n"; $vars['rdf_profile'] = ' profile="' . $vars['grddl_profile'] . '"'; } else { $vars['doctype'] = '<!DOCTYPE html>' . "\n"; $vars['rdf_profile'] = ''; } // Add externally hosted files. This will not work if entered in .info file. // Setting the group to CSS_THEME will load these files in the "theme group" // which load after system and module CSS files. This is not terribly // important in this case, but we do need to specify "external" as TRUE. // Ideally that wouldn't be necessary it would "just work" like // drupal_add_js(). See http://drupal.org/node/953340 to help make it happen. drupal_add_css('http://fonts.googleapis.com/css?family=Droid+Serif:regular,italic,bold,bolditalic&subset=latin', array('external' => TRUE, 'group' => CSS_THEME)); drupal_add_css('http://fonts.googleapis.com/css?family=Droid+Sans:regular,bold&subset=latin', array('external' => TRUE, 'group' => CSS_THEME)); // Create a variable containing the path to the theme. We'll use this in // in html.tpl.php. $vars['path'] = drupal_get_path('theme', 'dgd7'); // Add the regular theme stylesheets. // This is done here as opposed to using the .info file so that we can control // the order. Since we cannot add the external CSS files via .info and we need // those to load first, we add them all here. drupal_add_css($vars['path'] . '/css/layout.css', array('group' => CSS_THEME)); drupal_add_css($vars['path'] . '/css/forms.css', array('group' => CSS_THEME)); drupal_add_css($vars['path'] . '/css/style.css', array('group' => CSS_THEME)); // We have a separate CSS file for styling the tabs that we only want to load // when there are actually tabs present. The following code checks for the // existence of primary and secondary tabs and then proceeds to load the CSS // file if needed. if (menu_primary_local_tasks() || menu_secondary_local_tasks()) { drupal_add_css($vars['path'] . '/css/tabs.css', array('group' => CSS_THEME, 'preprocess' => FALSE)); } // Add a print stylesheet. drupal_add_css($vars['path'] . '/css/print.css', array('group' => CSS_THEME, 'media' => 'print', 'preprocess' => FALSE)); // Add a conditional stylesheet for Internet Explorer. // The "browsers" key allows you to specify what versions of IE to target. In // this case we are targeting "less than or equal to IE 7". Drupal will wrap // the code for this stylesheet in conditional comments: // "<!--[if lte IE 7]> … <![endif]-->. For more details about conditional // comments see: http://www.quirksmode.org/css/condcom.html drupal_add_css($vars['path'] . '/css/ie.css', array('browsers' => array('IE' => 'lte IE 7', '!IE' => FALSE), 'group' => CSS_THEME, 'preprocess' => FALSE)); // In template_preprocess_html() we have easy access to the "class" attribute // for the <body> element. Here we add a helper class that indicates that // there is no title for the page to help styling the content region easily. if (!drupal_get_title()) { $vars['classes_array'][] = 'no-title'; } }
function earthen_menu_local_tasks() { $output = ''; if ($primary = menu_primary_local_tasks()) { $output .= $primary; } if ($secondary = menu_secondary_local_tasks()) { $output .= $secondary; } return $output; }
/** * Adds clearfix to tabs. */ function scholar_base_menu_local_tasks() { $output = ''; if (menu_primary_local_tasks()) { $output .= '<ul class="tabs primary clearfix">' . menu_primary_local_tasks() . '</ul>'; } if (menu_secondary_local_tasks()) { $output .= '<ul class="tabs secondary clearfix">' . menu_secondary_local_tasks() . '</ul>'; } return $output; }
/** * Override or insert variables into the page template. */ function seven_preprocess_page(&$vars) { $vars['primary_local_tasks'] = menu_primary_local_tasks(); $vars['secondary_local_tasks'] = menu_secondary_local_tasks(); // get all the current css information into an array $css = drupal_add_css(); // Removing the css files of vertical tabs module because and use the seven style instead. unset($css['all']['module'][drupal_get_path('module', 'vertical_tabs') . '/vertical_tabs.css']); // now place the remaining css files back into the template variable for rendering $vars['styles'] = drupal_get_css($css); }
/** * Duplicate of theme_menu_local_tasks() but adds clear-block to tabs. */ function phptemplate_menu_local_tasks() { $output = ''; if ($primary = menu_primary_local_tasks()) { $output .= '<ul class="tabs primary clear-block">' . $primary . '</ul>'; } if ($secondary = menu_secondary_local_tasks()) { $output .= '<ul class="tabs secondary clear-block">' . $secondary . '</ul>'; } return $output; }
/** * 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'); }
/** * Override or insert PHPTemplate variables into the templates. */ function _phptemplate_variables($hook, $vars) { if ($hook != 'page') { return array(); } $vars['tabs'] = menu_primary_local_tasks(); $vars['tabs2'] = menu_secondary_local_tasks(); // Make $front_page variable available $vars['front_page'] = url(); drupal_add_js(path_to_theme() . '/script.js', 'theme'); $scripts = drupal_get_js(); $scripts = str_replace('misc/jquery.js', path_to_theme() . '/jquery.js', $scripts); $vars['scripts'] = $scripts; return $vars; }
/** * Override or insert PHPTemplate variables into the templates. */ function phptemplate_preprocess_page(&$vars) { $vars['tabs'] = ''; $primary = menu_primary_local_tasks(); if (!empty($primary)) { $vars['tabs'] = '<ul class="arttabs_primary">' . $primary . '</ul>'; } $vars['tabs2'] = ''; $secondary = menu_secondary_local_tasks(); if (!empty($secondary)) { $vars['tabs2'] = '<ul class="arttabs_secondary">' . $secondary . '</ul>'; } // Hook into color.module if (module_exists('color')) { _color_page_alter($vars); } }
function _phptemplate_variables($hook, $vars) { $view = get_artx_drupal_view(); $message = $view->get_incorrect_version_message(); if (!empty($message)) { drupal_set_message($message, 'error'); } if ($hook != 'page') { return array(); } $vars['tabs'] = menu_primary_local_tasks(); $vars['tabs2'] = menu_secondary_local_tasks(); $vars['front_page'] = url(); drupal_add_js(path_to_theme() . '/script.js', 'theme'); $scripts = drupal_get_js(); $scripts = str_replace('misc/jquery.js', path_to_theme() . '/jquery.js', $scripts); $vars['scripts'] = $scripts; return $vars; }
/** * Override or insert variables into the page template. */ function Cancilleria_preprocess_page(&$vars) { global $art_style, $art_head; $vars['tabs'] = menu_primary_local_tasks(); $vars['tabs2'] = menu_secondary_local_tasks(); if (isset($vars['node'])) { if (isset($vars['art_style_' . $vars['node']->nid])) { $art_style = $vars['art_style_' . $vars['node']->nid]; } if (isset($vars['art_head_' . $vars['node']->nid])) { $art_head = $vars['art_head_' . $vars['node']->nid]; } } if (isset($vars['art_blocks_head'])) { $art_head .= $vars['art_blocks_head']; } $vars['search_box'] = NULL; if (function_exists('search_box_form_submit')) { $vars['search_box'] = drupal_get_form('search_form'); } }
/** * Override or insert PHPTemplate variables into the templates. */ function _phptemplate_variables($hook, $vars) { if ($hook == 'page') { $vars['tabs'] = ''; $primary = menu_primary_local_tasks(); if (!empty($primary)) { $vars['tabs'] = '<ul class="arttabs_primary">' . $primary . '</ul>'; } $vars['tabs2'] = ''; $secondary = menu_secondary_local_tasks(); if (!empty($secondary)) { $vars['tabs2'] = '<ul class="arttabs_secondary">' . $secondary . '</ul>'; } // Hook into color.module if (module_exists('color')) { _color_page_alter($vars); } drupal_add_js(path_to_theme() . '/script.js', 'theme'); $vars['scripts'] = drupal_get_js(); return $vars; } return array(); }
/** * Override or insert variables into the page template. */ function seven_preprocess_page(&$vars) { $vars['primary_local_tasks'] = menu_primary_local_tasks(); $vars['secondary_local_tasks'] = menu_secondary_local_tasks(); }
/** * Returns the rendered local tasks. The default implementation renders * them as tabs. Overridden to split the secondary tasks. * * @ingroup themeable */ function phptemplate_menu_local_tasks() { return menu_primary_local_tasks(); }
function deco_render_content($tabs, $title, $messages, $classes) { $in_node = strstr($classes, 'page-node') ? TRUE : FALSE; $output = ''; $output .= !empty($title) ? '<h2 class="content-title">' . $title . '</h2>' : ''; $primary_tabs = menu_primary_local_tasks(); $tabs = drupal_render($primary_tabs); $output .= $tabs ? deco_menu_local_tasks('<ul class="tabs primary">' . $tabs . '</ul>') : ''; $secondary_tab = menu_secondary_local_tasks(); $secondary_tabs = drupal_render($secondary_tab); $output .= $secondary_tabs ? deco_menu_secondary_local_tasks('<ul class="tabs secondary">' . $secondary_tabs . '</ul>') : ''; $output .= $messages ? $messages : ''; return $output; }
/** * Returns the rendered local tasks. The default implementation renders * them as tabs. Overridden to split the secondary tasks. * * @ingroup themeable */ function primer_menu_local_tasks() { return menu_primary_local_tasks(); }
/** * Get all primary tasks including subsets */ function _bootstrap_local_tasks($tabs = FALSE) { if ($tabs == '') { return $tabs; } if (!$tabs) { $tabs = menu_primary_local_tasks(); } foreach ($tabs as $key => $element) { $result = db_select('menu_router', NULL, array('fetch' => PDO::FETCH_ASSOC))->fields('menu_router')->condition('tab_parent', $element['#link']['path'])->condition('context', MENU_CONTEXT_INLINE, '<>')->condition('type', array(MENU_DEFAULT_LOCAL_TASK, MENU_LOCAL_TASK), 'IN')->orderBy('weight')->orderBy('title')->execute(); $router_item = menu_get_item($element['#link']['href']); $map = $router_item['original_map']; $i = 0; foreach ($result as $item) { _menu_translate($item, $map, TRUE); //only add items that we have access to if ($item['tab_parent'] && $item['access']) { //set path to that of parent for the first item if ($i === 0) { $item['href'] = $element['#link']['href']; } if (current_path() == $item['href']) { $tabs[$key][] = array('#theme' => 'menu_local_task', '#link' => $item, '#active' => TRUE); } else { $tabs[$key][] = array('#theme' => 'menu_local_task', '#link' => $item); } //only count items we have access to. $i++; } } } return $tabs; }
/** * Renders the local tasks. * * The default implementation renders them as tabs. Overridden to split the * secondary tasks. * * @return string * The rendered local tasks. */ function nitobe_menu_local_tasks() { return menu_primary_local_tasks(); }
/** * Override of theme_menu_local_tasks(). * Add argument to allow primary/secondary local tasks to be printed * separately. Use theme_links() markup to consolidate. */ function tao_menu_local_tasks($type = '') { if ($primary = menu_primary_local_tasks()) { $primary = "<ul class='links primary-tabs'>{$primary}</ul>"; } if ($secondary = menu_secondary_local_tasks()) { $secondary = "<ul class='links secondary-tabs'>{$secondary}</ul>"; } switch ($type) { case 'primary': return $primary; case 'secondary': return $secondary; default: return $primary . $secondary; } }
/** * Returns the rendered local tasks. The default implementation renders * them as tabs. Overridden to split the secondary tasks. */ function garland_menu_local_tasks() { return menu_primary_local_tasks(); }
/** * Returns the rendered local tasks. The default implementation renders * them as tabs. Overridden to split the secondary tasks. * * @ingroup themeable */ function rootcandy_menu_local_tasks() { return menu_primary_local_tasks(); }
/** * Implementation of theme_menu_local_tasks(). */ function csa_base_menu_local_tasks() { $output = ''; if ($primary = menu_primary_local_tasks()) { $output .= "<ul class=\"tabs primary\">\n" . $primary . "</ul>\n"; } if ($secondary = menu_secondary_local_tasks()) { $output .= "</div>\n<div class=\"tabs secondary\">"; $output .= "<ul class=\"tabs secondary\">\n" . $secondary . "</ul>\n"; } return $output; }