/** * Implements theme_breadcrumb(). */ function nuboot_radix_breadcrumb($variables) { if (drupal_is_front_page()) { return; } $breadcrumb = $variables['breadcrumb']; $contexts = array(); if (!empty($breadcrumb)) { $output = '<h2 class="element-invisible">' . t('You are here') . '</h2>'; $crumbs = '<ul class="breadcrumb">'; if (!drupal_is_front_page()) { $crumbs .= '<li class="home-link"><a href="' . url('<front>') . '"><i class="fa fa fa-home"></i><span> Home</span></a></li>'; } // Remove null values. $breadcrumb = array_filter($breadcrumb); $i = 1; foreach ($breadcrumb as $value) { if ($i == count($breadcrumb)) { $crumbs .= '<li class="active-trail">' . $value . '</li>'; } else { $crumbs .= '<li>' . $value . '</li>'; } $i++; } $crumbs .= '</ul>'; return $crumbs; } }
/** * Implements hook_preprocess_page(). */ function uconn_theme_preprocess_page(&$variables) { $path = current_path(); $path_array = explode("/", $path); // Add script to the front page, to control the height of the three columns at the bottom. // Does not work natively in Zen grids, so this is required. if (drupal_is_front_page()) { $theme_path = drupal_get_path('theme', $GLOBALS['theme']); drupal_add_js("{$theme_path}/js/jquery.matchHeight-min.js"); drupal_add_js("{$theme_path}/js/matchHeightBehaviour.js"); } // Selectively add class to content, edge case requires particular // Styling on the search result page. Set here so it is always // Available. $variables['inner_page_wrapper'] = ""; if (count($path_array) >= 2) { if ($path_array[0] == 'islandora' && $path_array[1] == 'search') { global $_islandora_solr_queryclass; $sr = new IslandoraSolrResults(); $secondary_display_profiles = $sr->addSecondaries($_islandora_solr_queryclass); $default_rss_icon_location = "/sites/all/modules/islandora_solr_search/islandora_solr_config/images/rss.png"; $new_rss_icon_location = "/" . drupal_get_path('theme', 'uconn_theme') . '/images/rss_w.png'; $secondary_display_profiles = str_replace($default_rss_icon_location, $new_rss_icon_location, $secondary_display_profiles); if (isset($secondary_display_profiles)) { $variables['secondary_display_profiles'] = $secondary_display_profiles; } $variables['inner_page_wrapper'] = "inner-page-wrapper"; } } }
/** * @file * This file is empty by default because the base theme chain (Alpha & Omega) provides * all the basic functionality. However, in case you wish to customize the output that Drupal * generates through Alpha & Omega this file is a good place to do so. * * Alpha comes with a neat solution for keeping this file as clean as possible while the code * for your subtheme grows. Please read the README.txt in the /preprocess and /process subfolders * for more information on this topic. */ function songlap_preprocess_page(&$vars) { if (drupal_is_front_page()) { $breadcrumb = array(); $breadcrumb[] = t('Home'); drupal_set_breadcrumb($breadcrumb); } if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_null(arg(3))) { $term = taxonomy_term_load(arg(2)); $breadcrumb = ''; $breadcrumb .= '<div class="breadcrumb">'; $breadcrumb .= '<a href="' . $vars['front_page'] . '">' . t('Home') . '</a> '; $breadcrumb .= '» ' . $term->name; $breadcrumb .= '</div>'; $vars['breadcrumb'] = $breadcrumb; } if ($_GET['q'] == 'projects') { $breadcrumb = ''; $breadcrumb .= '<div class="breadcrumb">'; $breadcrumb .= '<a href="' . $vars['front_page'] . '">' . t('Home') . '</a> '; $breadcrumb .= '» ' . t('Projects'); $breadcrumb .= '</div>'; $vars['breadcrumb'] = $breadcrumb; } }
/** * Implements theme_breadcrumb(). */ function dkan_breadcrumb($variables) { if (drupal_is_front_page()) { return; } $breadcrumb = $variables['breadcrumb']; $contexts = array(); if (!empty($breadcrumb)) { foreach ($breadcrumb as $num => $item) { if ($item == '<a href="/">Home</a>') { $breadcrumb[$num] = '<a href="/"><i class="icon-large icon-home"></i><span> Home</span></a>'; } } $output = '<h2 class="element-invisible">' . t('You are here') . '</h2>'; $crumbs = '<ul class="breadcrumb">'; // Remove null values. $breadcrumb = array_filter($breadcrumb); $i = 1; foreach ($breadcrumb as $value) { if ($i == count($breadcrumb)) { $crumbs .= '<li class="active-trail">' . $value . '</li>'; } else { $crumbs .= '<li>' . $value . '</li>'; } $i++; } $crumbs .= '</ul>'; return $crumbs; } }
function elements_theme_links__system_main_menu($variables) { $links = $variables['links']; $attributes = $variables['attributes']; $heading = $variables['heading']; global $language_url; $output = ''; if (count($links) > 0) { $output = ''; // Treat the heading first if it is present to prepend it to the // list of links. if (!empty($heading)) { if (is_string($heading)) { // Prepare the array that will be used when the passed heading // is a string. $heading = array('text' => $heading, 'level' => 'h2'); } $output .= '<' . $heading['level']; if (!empty($heading['class'])) { $output .= drupal_attributes(array('class' => $heading['class'])); } $output .= '>' . check_plain($heading['text']) . '</' . $heading['level'] . '>'; } $output .= '<div id="pages">'; $num_links = count($links); $i = 1; foreach ($links as $key => $link) { $class = array($key); // Add first, last and active classes to the list of links to help out themers. if ($i == 1) { $class[] = 'first'; } if ($i == $num_links) { $class[] = 'last'; } if (isset($link['href']) && ($link['href'] == $_GET['q'] || $link['href'] == '<front>' && drupal_is_front_page()) && (empty($link['language']) || $link['language']->language == $language_url->language)) { $class[] = 'active'; } $output .= '<span class="menu-items"><h3>'; if (isset($link['href'])) { // Pass in $link as $options, they share the same keys. $output .= l($link['title'], $link['href'], $link); } elseif (!empty($link['title'])) { // Some links are actually not links, but we wrap these in <span> for adding title and class attributes. if (empty($link['html'])) { $link['title'] = check_plain($link['title']); } $span_attributes = ''; if (isset($link['attributes'])) { $span_attributes = drupal_attributes($link['attributes']); } $output .= '<h3' . $span_attributes . '>' . $link['title'] . '</h3><span>' . $link['attributes']['title'] . '</span'; } $i++; $output .= "</h3>" . $link['attributes']['title'] . "</span>\n"; } $output .= '</div>'; } return $output; }
/** * Overrides theme_menu_link(). */ function bootstrap_menu_link(array $variables) { $element = $variables['element']; $sub_menu = ''; if ($element['#below']) { // Prevent dropdown functions from being added to management menu so it // does not affect the navbar module. if ($element['#original_link']['menu_name'] == 'management' && module_exists('navbar')) { $sub_menu = drupal_render($element['#below']); } elseif (!empty($element['#original_link']['depth']) && $element['#original_link']['depth'] >= 1) { // Add our own wrapper. unset($element['#below']['#theme_wrappers']); $sub_menu = '<ul class="dropdown-menu">' . drupal_render($element['#below']) . '</ul>'; // Generate as standard dropdown. //$element['#title'] .= ' <span class="caret"></span>'; $element['#attributes']['class'][] = 'dropdown'; $element['#localized_options']['html'] = TRUE; // Set dropdown trigger element to # to prevent inadvertant page loading // when a submenu link is clicked. //$element['#localized_options']['attributes']['data-target'] = '#'; $element['#localized_options']['attributes']['class'][] = 'dropdown-toggle'; //$element['#localized_options']['attributes']['data-toggle'] = 'dropdown'; } } // On primary navigation menu, class 'active' is not set on active menu item. // @see https://drupal.org/node/1896674 if (($element['#href'] == $_GET['q'] || $element['#href'] == '<front>' && drupal_is_front_page()) && empty($element['#localized_options']['language'])) { $element['#attributes']['class'][] = 'active'; } $output = l($element['#title'], $element['#href'], $element['#localized_options']); return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n"; }
function _myu_language_dropdown($type = 'language') { if (drupal_multilingual()) { global $language_url; $path = drupal_is_front_page() ? '<front>' : $_GET['q']; //$type = 'language_url'; $languages = language_negotiation_get_switch_links($type, $path); $items = array(); foreach ($languages->links as $lang_code => $lang_options) { if ($lang_options['language']->language === $language_url->language) { // Icon for the selected language if (module_exists('languageicons')) { $icon = theme('languageicons_icon', array('language' => (object) array('language' => $lang_code), 'title' => $language_url->native)); } $active_language_text = $icon . '<span class="langname">' . strtoupper($language_url->language) . '</span><i class="fa fa-angle-down"></i>'; $active_language_link = l($active_language_text, 'javascript:;', array('html' => TRUE, 'external' => TRUE, 'attributes' => array('class' => 'dropdown-toggle', 'data-close-others' => 'true', 'data-hover' => 'dropdown', 'data-toggle' => 'dropdown'))); } else { if (!isset($lang_options['query'])) { $lang_options['query'] = drupal_get_query_parameters(); } $items[] = l($lang_options['title'], $lang_options['href'], $lang_options); } } $language_flag_list = theme('item_list', array('items' => $items, 'type' => 'ul', 'attributes' => array('class' => 'dropdown-menu dropdown-menu-default'))); return '<ul class="menu nav navbar-nav language"><li class="dropdown dropdown-language">' . $active_language_link . $language_flag_list . '</li></ul>'; } }
/** * Returns HTML for menu link. */ function boot_press_menu_link(array $variables) { $element = $variables['element']; $sub_menu = ''; if ($element['#below']) { if ($element['#original_link']['menu_name'] == 'management' && module_exists('navbar')) { $sub_menu = drupal_render($element['#below']); } else { unset($element['#below']['#theme_wrappers']); $sub_menu = '<ul class="dropdown-menu">' . drupal_render($element['#below']) . '</ul>'; $element['#localized_options']['attributes']['class'][] = 'dropdown-toggle'; $element['#localized_options']['attributes']['data-toggle'] = 'dropdown'; if (!empty($element['#original_link']['depth']) && $element['#original_link']['depth'] > 1) { $element['#attributes']['class'][] = 'dropdown-submenu'; } else { $element['#attributes']['class'][] = 'dropdown'; $element['#localized_options']['html'] = TRUE; $element['#title'] .= ' <span class="caret"></span>'; } $element['#localized_options']['attributes']['data-target'] = '#'; } } if (($element['#href'] == $_GET['q'] || $element['#href'] == '<front>' && drupal_is_front_page()) && (empty($element['#localized_options']['language']) || $element['#localized_options']['language']->language == $language_url->language)) { $element['#attributes']['class'][] = 'active'; } $menu_output = l($element['#title'], $element['#href'], $element['#localized_options']); return '<li' . drupal_attributes($element['#attributes']) . '>' . $menu_output . $sub_menu . "</li>\n"; }
function phptemplate_menu_links($links, $attributes = array()) { if (!count($links)) { return ''; } $level_tmp = explode('-', key($links)); $level = $level_tmp[0]; $output = "<ul class=\"links-{$level} " . $attributes['class'] . "\" id=\"" . $attributes['id'] . "\">\n"; $num_links = count($links); $i = 1; foreach ($links as $index => $link) { $output .= '<li'; $output .= ' class="'; if (stristr($index, 'active')) { $output .= 'active'; } elseif (drupal_is_front_page() && $link['href'] == '<front>') { $link['attributes']['class'] = 'active'; $output .= 'active'; } if ($i == 1) { $output .= ' first'; } if ($i == $num_links) { $output .= ' last'; } $output .= '"'; $output .= ">" . l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment']) . "</li>\n"; $i++; } $output .= '</ul>'; return $output; }
/** * Override or insert variables into the html templates. */ function constellation_preprocess_html(&$vars) { if (drupal_is_front_page()) { $vars['head_title'] = 'Freelance Drupal web development | NEAR DARK Design Studio'; } // Load the media queries styles // Remember to rename these files to match the names used here - they are // in the CSS directory of your subtheme. $media_queries_css = array('constellation.responsive.style.css', 'constellation.responsive.gpanels.css'); load_subtheme_media_queries($media_queries_css, 'constellation'); drupal_add_css(drupal_get_path('theme', 'constellation') . '/css/ie-8.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'preprocess' => FALSE)); //dpm($vars); /** * Load IE specific stylesheets * AT automates adding IE stylesheets, simply add to the array using * the conditional comment as the key and the stylesheet name as the value. * * See our online help: http://adaptivethemes.com/documentation/working-with-internet-explorer * * For example to add a stylesheet for IE8 only use: * * 'IE 8' => 'ie-8.css', * * Your IE CSS file must be in the /css/ directory in your subtheme. */ /* -- Delete this line to add a conditional stylesheet for IE 7 or less. $ie_files = array( 'lte IE 7' => 'ie-lte-7.css', ); load_subtheme_ie_styles($ie_files, 'constellation'); // */ }
/** * Overrides theme_menu_link() for book module. */ function bootstrap_menu_link__book_toc(array $variables) { $element = $variables['element']; $sub_menu = drupal_render($element['#below']); $title = $element['#title']; $href = $element['#href']; $options = !empty($element['#localized_options']) ? $element['#localized_options'] : array(); $attributes = !empty($element['#attributes']) ? $element['#attributes'] : array(); $attributes['role'] = 'presentation'; // Header. $link = TRUE; if ($title && $href === FALSE) { $attributes['class'][] = 'dropdown-header'; $link = FALSE; } elseif ($title === FALSE && $href === FALSE) { $attributes['class'][] = 'divider'; $link = FALSE; } elseif (($href == $_GET['q'] || $href == '<front>' && drupal_is_front_page()) && empty($options['language'])) { $attributes['class'][] = 'active'; } // Filter the title if the "html" is set, otherwise l() will automatically // sanitize using check_plain(), so no need to call that here. if (!empty($options['html'])) { $title = _bootstrap_filter_xss($title); } // Convert to a link. if ($link) { $title = l($title, $href, $options); } return '<li' . drupal_attributes($attributes) . '>' . $title . $sub_menu . "</li>\n"; }
function cstark_preprocess_node(&$variables) { if (user_access('administer nodes')) { $variables['edit_link'] = l(t('Edit'), 'node/' . $variables['nid'] . '/edit'); if ($variables['type'] == 'painting') { $title = $variables['promote'] ? t('Remove from front page') : t('Add to front page'); $variables['set_as_main_link'] = l($title, 'set-as-main/' . $variables['nid']); // Facebook share. $url = url('node/' . $variables['nid'], array('absolute' => TRUE)); $variables['share_link'] = l(t('Share'), "http://www.facebook.com/sharer.php?u={$url}", array('attributes' => array('class' => array('facebook')))); } } if ($variables['type'] == 'painting') { $wrapper = entity_metadata_wrapper('node', $variables['nid']); if ($image = $wrapper->field_image->value()) { $element = array('#tag' => 'meta', '#attributes' => array('property' => 'og:image', 'content' => file_create_url($image['uri']))); drupal_add_html_head($element, 'cstark_painting_image'); $element = array('#tag' => 'meta', '#attributes' => array('property' => 'og:title', 'content' => $wrapper->label())); drupal_add_html_head($element, 'cstark_painting_title'); } } if ($variables['type'] == 'painting' && !drupal_is_front_page()) { $variables['pager'] = shapira_get_painting_pager($variables['nid']); } if ($variables['type'] != 'news') { $variables['hide_title'] = true; } if ($variables['type'] == 'painting') { if ($variables['field_image']) { $info = image_get_info(image_style_path('painting', $variables['field_image'][0]['uri'])); $variables['node_width'] = $info['width']; } } }
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; }
function hc_bootstrap_preprocess_page(&$variables) { //Set default section to display if (drupal_is_front_page()) { menu_set_active_item('food-and-groceries'); } /** * 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; } } } //Add shopping cart to available output $variables['side_cart'] = block_render('views', 'sidebar_cart-cart'); }
/** * Preprocessor for theme('page'). */ function jake_preprocess_page(&$vars) { // Help link if (!empty($vars['help'])) { $vars['help_link'] = l('?', $_GET['q'], array('fragment' => 'help', 'attributes' => array('class' => 'help-link'))); } // Admin link if (user_access('administer mn')) { $vars['admin_link'] = l(t('Admin'), 'admin/settings/site-information', array('attributes' => array('class' => 'admin-link'))); } // Add body class for layout. $vars['attr']['class'] .= !empty($vars['template_files']) ? ' ' . end($vars['template_files']) : ''; // Site name $vars['site_name'] = theme('site_name'); // Display mission in a block if (!empty($vars['mission']) && drupal_is_front_page()) { $mission_block = new stdClass(); $mission_block->content = $vars['mission']; $vars['mission_block'] = theme('block', $mission_block); } // Truncate the slogan so it doesn't break the header $vars['site_slogan'] = truncate_utf8($vars['site_slogan'], 35); // Determine stack height for fullscreen views. $class = array(); if ($stackclass = context_get('theme', 'stackclass')) { $class[] = $stackclass; } if (!empty($vars['tabs'])) { $class[] = 'tabs'; } if (!empty($class)) { $vars['attr']['class'] .= ' with-' . implode('-', $class); } }
function education_pager($vars) { if (drupal_is_front_page() && theme_get_setting('hide_pager_frontpage')) { return ''; } return theme_pager($vars); }
function falkor_preprocess_html(&$vars) { // Optionally, drop the site slogan from the page <title> if (drupal_is_front_page()) { // $vars['head_title'] = $vars['head_title_array']['name']; } }
/** * @param $variables */ function beko_preprocess_page(&$variables) { drupal_add_js(drupal_get_path('theme', 'beko') . '/js/jquery.min.js', array('weight' => 1)); $variables['imagepath'] = $variables['base_path'] . $variables['directory'] . '/images/'; if (drupal_is_front_page()) { drupal_add_js(drupal_get_path('theme', 'beko') . '/js/sticky.js', array('weight' => 2)); } }
/** * Implements hook_breadcrumbs_alter(). */ function portland_menu_breadcrumb_alter(&$active_trail, $item) { // Shifts the first element from the active trail array. We assume that this // is the front page. if (!drupal_is_front_page()) { array_shift($active_trail); } }
/** * Override or insert variables into the page templates. * * @param $variables * An array of variables to pass to the theme template. * @param $hook * The name of the template being rendered ("page" in this case.) */ function ppsr_theme_preprocess_page(&$variables, $hook) { if (drupal_is_front_page()) { drupal_add_js(drupal_get_path('theme', 'ppsr_theme') . '/js/news-feed.js', array('scope' => 'footer')); drupal_add_js('google.load("feeds", "1");', 'inline'); drupal_add_js('window.onload=function() {rssfeedsetup()}', 'inline'); } }
/** * Implements hook_html_head_alter(). */ function tweme_html_head_alter(&$head_elements) { foreach ($head_elements as &$element) { if (isset($element['#attributes']['rel']) && in_array($element['#attributes']['rel'], array('canonical', 'shortlink')) && drupal_is_front_page()) { $element['#attributes']['href'] = '/'; } } }
function bfw2015_preprocess_html(&$vars) { if (drupal_is_front_page()) { $vars['head_title'] = variable_get('site_name') . ' | ' . variable_get('site_slogan'); } bfw2015_add_icons(); drupal_add_css('//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', array('type' => 'external')); }
function analytics_portal_preprocess_html(&$vars, $hook) { if (drupal_is_front_page() && !user_is_logged_in()) { // If the content type's machine name is "my_machine_name" the file // name will be "page--my-machine-name.tpl.php". $vars['theme_hook_suggestions'][] = 'html__custom'; } }
function framework_links($links, $attributes = array('class' => 'links'), $heading = '') { global $language; $output = ''; if (count($links) > 0) { // Treat the heading first if it is present to prepend it to the // list of links. if (!empty($heading)) { if (is_string($heading)) { // Prepare the array that will be used when the passed heading // is a string. $heading = array('text' => $heading, 'level' => 'h2'); } $output .= '<' . $heading['level']; if (!empty($heading['class'])) { $output .= drupal_attributes(array('class' => $heading['class'])); } $output .= '>' . check_plain($heading['text']) . '</' . $heading['level'] . '>'; } $output .= '<ul' . drupal_attributes($attributes) . '>'; $num_links = count($links); $i = 1; foreach ($links as $key => $link) { $class = $key; // Add first, last and active classes to the list of links to help out themers. if ($i == 1) { $class .= ' first'; } if ($i == $num_links) { $class .= ' last'; } if (isset($link['href']) && ($link['href'] == $_GET['q'] || $link['href'] == '<front>' && drupal_is_front_page()) && (empty($link['language']) || $link['language']->language == $language->language)) { $class .= ' active'; } $output .= '<li' . drupal_attributes(array('class' => $class)) . '>'; if (isset($link['href'])) { // Pass in $link as $options, they share the same keys. $output .= l($link['title'], $link['href'], $link); } else { if (!empty($link['title'])) { // Some links are actually not links, but we wrap these in <span> for adding title and class attributes if (empty($link['html'])) { $link['title'] = check_plain($link['title']); } $span_attributes = ''; if (isset($link['attributes'])) { $span_attributes = drupal_attributes($link['attributes']); } $output .= '<span' . $span_attributes . '>' . $link['title'] . '</span>'; } } $i++; $output .= "</li>\n"; } $output .= '</ul>'; } return $output; }
function epf_links__system_main_menu($variables) { $links = $variables['links']; global $language_url; $output = ''; if (count($links) > 0) { $output = ''; $output .= '<ul>'; $num_links = count($links); $i = 1; foreach ($links as $key => $link) { $class = array($key); if (isset($link['href']) && ($link['href'] == $_GET['q'] || $link['href'] == arg(0)) && !drupal_is_front_page() && (empty($link['language']) || $link['language']->language == $language_url->language)) { $class[] = 'selected'; } elseif (isset($link['below'])) { foreach ($link['below'] as $keyb => $linkb) { if (isset($linkb['href']) && ($linkb['href'] == $_GET['q'] || $linkb['href'] == arg(0)) && !drupal_is_front_page() && (empty($linkb['language']) || $linkb['language']->language == $language_url->language)) { $class[] = 'selected'; } } } $output .= '<li>'; if (isset($link['href'])) { // Pass in $link as $options, they share the same keys. $output .= '<a href="' . check_plain(url($link['href'])) . '"' . drupal_attributes(array('class' => $class)) . '><span>' . $link['title'] . '</span></a>'; } elseif (!empty($link['title'])) { // Some links are actually not links, but we wrap these in <span> for adding title and class attributes. if (empty($link['html'])) { $link['title'] = check_plain($link['title']); } $output .= '<span>' . $link['title'] . '</span>'; } if (isset($link['below'])) { $output .= '<ul>'; foreach ($link['below'] as $keyb => $linkb) { $class = array($keyb); $output .= '<li>'; if (isset($linkb['href'])) { // Pass in $link as $options, they share the same keys. $output .= '<a href="' . check_plain(url($linkb['href'])) . '"' . drupal_attributes(array('class' => $class)) . '>' . $linkb['title'] . '</a>'; } elseif (!empty($linkb['title'])) { // Some links are actually not links, but we wrap these in <span> for adding title and class attributes. if (empty($linkb['html'])) { $linkb['title'] = check_plain($linkb['title']); } $output .= $linkb['title']; } $output .= "</li>\n"; } $output .= '</ul>'; } $i++; $output .= "</li>\n"; } $output .= '</ul>'; } return $output; }
/** * Return themed links. * Creates the type of delimiter used for $links */ function flower_links($links, $attributes = array('class' => 'links')) { $output = ''; $is_front = drupal_is_front_page(); if (count($links) > 0) { $num_links = count($links); $i = 1; $output = '<ul class="' . $attributes['class'] . '">'; foreach ($links as $key => $link) { $class = ''; // Automatically add a class to each link and also to each LI if (isset($link['attributes']) && isset($link['attributes']['class'])) { $link['attributes']['class'] .= ' ' . $key; $class = $key; } else { if ($i == 1 && $is_front) { $link['attributes']['class'] = $key . '-active active'; $class = $key . '-active'; } else { $link['attributes']['class'] = $key; $class = $key; } } // Add first and last classes to the list of links to help out themers. $extra_class = ''; if ($i == 1) { $extra_class .= 'first '; } else { // $output .= ' | '; } if ($i == $num_links) { $extra_class .= 'last '; } $output .= '<li class="' . $extra_class . $class . '">'; // Is the title HTML? $html = isset($link['html']) && $link['html']; // Initialize fragment and query variables. $link['query'] = isset($link['query']) ? $link['query'] : NULL; $link['fragment'] = isset($link['fragment']) ? $link['fragment'] : NULL; if (isset($link['href'])) { $output .= l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment'], FALSE, $html); } else { if ($link['title']) { //Some links are actually not links, but we wrap these in <span> for adding title and class attributes if (!$html) { $link['title'] = check_plain($link['title']); } $output .= '<li' . drupal_attributes($link['attributes']) . '>' . $link['title'] . '</li>'; } } $i++; $output .= "</li>\n"; } $output .= "</ul>"; } return $output; }
/** * Implements hook_page_alter(). */ function excelpoint_page_alter(&$page) { if (drupal_is_front_page()) { drupal_set_title(''); } if ($page['#type'] === 'page') { drupal_set_title(''); } }
/** * Add missing active class, that is normally handled by theme_links... * @param $link */ private function add_active_class(&$link) { global $language_url; global $user; if (isset($link['#href']) && ($link['#href'] == $_GET['q'] || $link['#href'] == '<front>' && drupal_is_front_page()) && (empty($link['language']) || $link['language']->language == $language_url->language) || $_GET['q'] == 'user/' . $user->uid && $link['#href'] == 'user') { // victory ! $link['#attributes']['class'][] = 'active'; } }
/** * Implements template_preprocess_page(). * 1. Check if sidebars have content; Add boolean to $variables * 2. Setup the user menu (by default displayed in header) */ function bear_skin_preprocess_page(&$variables) { $page = $variables['page']; // set the page title for the homepage // for accessibility purposes $title = drupal_get_title(); if (drupal_is_front_page() && empty($title)) { $variables['bear_page_title'] = variable_get('site_name', '') . ' Homepage'; } else { $variables['bear_page_title'] = $title; } // check if there is content in the sidebars $variables['has_sidebar_first'] = FALSE; $variables['has_sidebar_second'] = FALSE; if (!empty($page['sidebar_first'])) { $variables['has_sidebar_first'] = TRUE; } if (!empty($page['sidebar_second'])) { $variables['has_sidebar_second'] = TRUE; } // setup the user menu to display in the header $variables['user_menu'] = theme('links__user_menu', array('links' => menu_navigation_links('user-menu'), 'attributes' => array('class ' => array('nav-user__list'), 'aria-labelledby' => 'userMenuLabel'))); // include the basic search form if one exists if (module_exists('search')) { $bear_search_form = module_invoke('search', 'block_view', 'search'); $variables['page']['bear_search_form'] = render($bear_search_form); } }
function mothership_links($links, $attributes = array('class' => 'links')) { // dsm($links); $output = ''; if (count($links) > 0) { if (theme_get_setting('mothership_cleanup_links_baseclass')) { $output = ' <ul' . drupal_attributes($attributes) . '>'; } else { $output = ' <ul>'; } $num_links = count($links); $i = 1; foreach ($links as $key => $link) { $class = $key; if (theme_get_setting('mothership_cleanup_menu_classes_first_last')) { // Add first, last and active classes to the list of links to help out themers. if ($i == 1) { $class .= ' first'; } if ($i == $num_links) { $class .= ' last'; } } if (theme_get_setting('mothership_cleanup_menu_classes_active')) { if (isset($link['href']) && ($link['href'] == $_GET['q'] || $link['href'] == '<front>' && drupal_is_front_page())) { $class .= ' active'; } } if (isset($link['href'])) { // add active class for containing <li> and <a> if active-trail is set on the link itself if (theme_get_setting('mothership_menu_classes_active')) { if (strpos($link['attributes']['class'], 'active-trail') !== FALSE && strpos($class, 'active') === FALSE) { $class .= ' active'; $link['attributes']['class'] .= ' active'; } } // Pass in $link as $options, they share the same keys. $link = l($link['title'], $link['href'], $link); } elseif (!empty($link['title'])) { // Some links are actually not links, but we wrap these in <span> for adding title and class attributes if (empty($link['html'])) { $link['title'] = check_plain($link['title']); } $span_attributes = ''; if (isset($link['attributes'])) { $span_attributes = drupal_attributes($link['attributes']); } $link = '<span' . $span_attributes . '>' . $link['title'] . '</span>'; } $i++; // array_search($class) ; $output .= ' <li' . drupal_attributes(array('class' => $class)) . '>'; $output .= $link; $output .= "</li>\n"; } $output .= '</ul>' . "\n"; } return $output; }