/** * Implements theme_menu_link() */ function startertheme_menu_link(array $variables) { // add a unqiue class for every menu item. $variables['element']['#attributes']['class'][] = 'menu-' . $variables['element']['#original_link']['mlid']; $variables['element']['#localized_options']['attributes']['class'][] = 'menu-' . $variables['element']['#original_link']['mlid']; return theme_menu_link($variables); }
/** * Overrides theme_menu_link(). */ function theme_minima_menu_link(array $variables) { // Add classes to li $variables['element']['#attributes']['class'][] = 'navigation__item'; // Add classes to li > a $variables['element']['#localized_options']['attributes']['class'][] = 'navigation__link'; return theme_menu_link($variables); }
/** * theme_menu_link() */ function badistrotheme_menu_link(array $variables) { $variables['element']['#attributes']['id'][] = $variables['element']['#original_link']['menu_name'] . '-' . $variables['element']['#original_link']['mlid']; $variables['element']['#attributes']['class'][] = 'menu-' . $variables['element']['#original_link']['mlid']; $variables['element']['#localized_options']['attributes']['class'][] = 'menu-' . $variables['element']['#original_link']['mlid']; $variables['element']['#localized_options']['attributes']['class'][] = $variables['element']['#original_link']['menu_name'] . '-' . check_plain($variables['element']['#original_link']['title']); return theme_menu_link($variables); }
function hc_bootstrap_menu_link(&$vars) { $link = $vars['element']['#original_link']; $menu_name = $link['menu_name']; if ('menu-user-menu' == $menu_name) { $vars['element']['#attributes']['class'][] = 'col-sm-4'; } return theme_menu_link($vars); }
/** * Implements hook_menu_link() */ function abitu_menu_link(array $variables) { //add class for li $variables['element']['#attributes']['class'][] = 'menu-' . $variables['element']['#original_link']['mlid']; //add class for a $variables['element']['#localized_options']['attributes']['class'][] = 'menu-' . $variables['element']['#original_link']['mlid']; //dvm($variables['element']); return theme_menu_link($variables); }
/** * @file * Contains the theme's functions to manipulate Drupal's default markup. * * Complete documentation for this file is available online. * @see https://drupal.org/node/1728096 */ function asta_2015_menu_link__menu_block(array $variables) { //Separator auf der 1. Ebene wird ersetzt, erzwingt neue Zeile $element = $variables['element']; if ($element['#href'] == "<separator>" && $element['#original_link']['depth'] == '1') { return "<span class=\"separator\"></span></ul><ul class=\"menu menu2\">\n"; } else { return theme_menu_link($variables); } }
/** * Implements theme_menu_link(). */ function d4eu_menu_link(&$variables) { // Catch the case of a home image. if ($variables['element']['#title'] == '<span class="glyphicon glyphicon-home menu-no-title"></span>') { // Classes on link <a>. $variables['element']['#localized_options']['attributes']['class'][] = 'glyphicon'; $variables['element']['#localized_options']['attributes']['class'][] = 'glyphicon-home'; // Invisible span (element-invisible) around link text <a>. $variables['element']['#localized_options']['html'] = TRUE; $variables['element']['#title'] = "<span class='element-invisible'>home</span>"; } return theme_menu_link($variables); }
/** * Process menu links */ function gladstone_org_menu_link(array $variables) { // Rewrite "icon" links if (!empty($variables['element']['#localized_options'])) { $attrs = $variables['element']['#localized_options']['attributes']; if (array_key_exists('class', $attrs) && in_array('icon-only', $attrs['class'])) { $title = $variables['element']['#title']; $href = $variables['element']['#href']; $classes = implode(' ', $attrs['class']); return '<li class="' . implode(' ', $variables['element']['#attributes']['class']) . '">' . '<a href="' . $href . '" class="' . $classes . '" title="' . $title . '"></a></li>'; } else { // Return default link return theme_menu_link($variables); } } }
/** * theme_menu_link() */ function storvargen_menu_link(array $variables) { //dpm($variables); $title_class = strtolower($variables['element']['#title']); $title_class = str_replace(' ', '-', $title_class); $theme_path = drupal_get_path('theme', 'storvargen'); $banners = array("home" => theme('image', array('path' => $theme_path . '/images/storvargen_nav_banner.png')), "gallery" => theme('image', array('path' => $theme_path . '/images/storvargen_nav_gallery.png')), "contact-us" => theme('image', array('path' => $theme_path . '/images/storvargen_nav_contact-us.png')), "encyclopedia" => theme('image', array('path' => $theme_path . '/images/storvargen_nav_encyclopedia.png')), "library" => theme('image', array('path' => $theme_path . '/images/storvargen_nav_library.png')), "archive" => theme('image', array('path' => $theme_path . '/images/storvargen_nav_archive.png'))); //add class for li $variables['element']['#attributes']['class'][] = 'menu-' . $variables['element']['#original_link']['mlid']; $variables['element']['#attributes']['class'][] = $title_class; //add class for a $variables['element']['#localized_options']['attributes']['class'][] = 'menu-' . $variables['element']['#original_link']['mlid']; $variables['element']['#localized_options']['attributes']['class'][] = $title_class . '-link'; if (array_key_exists($title_class, $banners)) { $variables['element']['#title'] = $banners[$title_class]; $variables['element']['#localized_options']['html'] = TRUE; } //dvm($variables['element']); return theme_menu_link($variables); }
function agency_1_menu_link($variables) { //Add classes to the menu <li> and <a> tags $menu_class = preg_replace("/[\\s_]/", "-", preg_replace("/[\\s-]+/", " ", preg_replace("/[^a-z0-9_\\s-]/", "", strtolower($variables['element']['#original_link']['link_title'])))); //<li> $variables['element']['#attributes']['class'][] = 'menu-li-' . $menu_class; //<a> if (isset($variables['element']['#localized_options'])) { $variables['element']['#localized_options']['attributes']['class'][] = 'menu-' . $menu_class; } return theme_menu_link($variables); }
function zimmer_menu_link__menu_block($variables) { return theme_menu_link($variables); }
/** * Generate the HTML output for a menu link and submenu. * * @param $variables * An associative array containing: * - element: Structured array data for a menu link. * * @return * A themed HTML string. * * @ingroup themeable * */ function cpstandard_menu_link(array $variables) { $element = $variables['element']; // If there is a CSS class on the link that starts with "icon-", create // additional HTML markup for the icon, and move that specific classname there. if (isset($element['#original_link']['options']['attributes']['class'])) { foreach ($element['#original_link']['options']['attributes']['class'] as $key => $class) { if (substr($class, 0, 3) == 'fa-') { // We're injecting custom HTML into the link text, so if the original // link text was not set to allow HTML (the usual case for menu items), // we MUST do our own filtering of the original text with check_plain(), // then specify that the link text has HTML content. if (!isset($element['#original_link']['options']['html']) || empty($element['#original_link']['options']['html'])) { $element['#title'] = check_plain($element['#title']); $element['#localized_options']['html'] = TRUE; } // Create additional HTML markup for the link's icon element and wrap // the link text in a SPAN element, to easily turn it on or off via CSS. $element['#title'] = '<i class="' . $class . '"></i> <span>' . $element['#title'] . '</span>'; // Finally, remove the icon class from link options, so it is not // printed twice. unset($element['#original_link']['localized_options']['attributes']['class'][$key]); $element['#localized_options']['attributes']['class'] = $element['#original_link']['localized_options']['attributes']['class']; //dpm($element); // For debugging. } } } // Save our modifications, and call core theme_menu_link(). $variables['element'] = $element; return theme_menu_link($variables); }
/** * Implements hook_menu_link(). * * Adds classes to user account menu item. */ function futurium_isa_theme_menu_link(array $variables) { $class = str_replace(" ", "-", strtolower($variables['element']['#title'])); $variables['element']['#attributes']['class'][] = 'menu-item'; $variables['element']['#attributes']['class'][] = $class; // Add stats glyphicon. if ($variables['element']['#original_link']['menu_name'] == 'main-menu' && $variables['element']['#original_link']['link_path'] == 'analytics') { $variables['element']['#localized_options']['html'] = TRUE; $variables['element']['#title'] = '<span class="glyphicons-signal"></span> ' . t("Stats"); } // Remove active class from parent if in sub-menu pages. if ($variables['element']['#original_link']['menu_name'] == 'menu-user-tabs' || $variables['element']['#original_link']['menu_name'] == 'menu-group-tabs') { if ($variables['element']['#href'] != $_GET['q']) { if (isset($variables['element']['#localized_options']['attributes']['class'])){ $active_class_key = array_search('active',$variables['element']['#localized_options']['attributes']['class']); unset($variables['element']['#localized_options']['attributes']['class'][$active_class_key]); } } } return theme_menu_link($variables); }
/** * Overrides theme_menu_link(). */ function iha_menu_link__menu_block($variables) { return theme_menu_link($variables); }
/** * Override menu_link to do fine alterations to theme according to vizz. * * @param $variables * An array of variables to pass to the theme template. * */ function vizz2_menu_link(array $variables) { /* Clear the "theme" attributes as they're not needed * Change the class from "active" to "selected" but only for level * 2 (and active) menu entries; for the rest clear the class */ $element = $variables['element']; $element['#localized_options']['html'] = TRUE; if ($element['#bid']['module'] === 'menu_block') { $element['#theme'] = array(''); if ($element['#bid']['delta'] === '1') { $element['#title'] = '<span>' . $element['#title'] . '</span>'; if (in_array('active', $element['#attributes']['class']) or in_array('active-trail', $element['#attributes']['class'])) { $element['#attributes']['class'] = array('selected'); } else { $element['#attributes']['class'] = array(''); } } } $variables['element'] = $element; return theme_menu_link($variables); }
function osha_frontend_menu_link__menu_block__menu_footer_menu($variables) { $element =& $variables['element']; $delta = $element['#bid']['delta']; // Render or not the Menu Image. // Get the variable provided by osha_menu module. $render_img = variable_get('menu_block_' . $delta . '_' . OSHA_MENU_RENDER_IMG_VAR_NAME, 0); if (!$render_img) { return theme_menu_link($variables); } if (!empty($element['#localized_options']['content']['image']) && ($image_url = file_create_url($element['#localized_options']['content']['image']))) { $image = '<img src="' . $image_url . '"/>'; $output_image = l($image, $element['#href'], array('html' => TRUE, 'attributes' => $element['#localized_options']['attributes'])); return '<li' . drupal_attributes($element['#attributes']) . '>' . $output_image . '</li>'; } else { $output_link = l($element['#title'], $element['#href'], $element['#localized_options']); return '<li' . drupal_attributes($element['#attributes']) . '>' . $output_link . '</li>'; } }
function casabienestar_menu_casabienestar(array $variables) { //add class for li $variables['element']['#attributes']['class'][] = ''; //add class for a $variables['element']['#localized_options']['attributes']['class'][] = ''; //dvm($variables['element']); return theme_menu_link($variables); }
/** * Add classes to the menu <li> and <a> ta */ function az_gov_menu_link($vars) { //gs $menu_class = str_replace(' ', '-', strtolower($vars['element']['#original_link']['link_title'])); $vars['element']['#attributes']['class'][] = 'menu-li-' . $menu_class; if (isset($variables['element']['#localized_options'])) { $vars['element']['#localized_options']['attributes']['class'][] = 'menu-' . $menu_class; } return theme_menu_link($vars); }
function wet4_menu_link__sidebar_menu_sub($variables) { // Add class for a. $variables['element']['#localized_options']['attributes']['class'][] = 'list-group-item sub-group-item'; return theme_menu_link($variables); }
/** * Overrides function theme_menu_link(). */ function greences_menu_link(array $variables) { $itemclass = str_replace('/', '-', $variables['element']['#href']); $variables['element']['#attributes']['class'][] = $itemclass; return theme_menu_link($variables); }
/** * Implements theme_menu_link(). * * Add id to for every menu item and copy a tag attributes to li tag. */ function vp_theme_menu_link($variables) { // Add id for every menu item (faster and better hooking for megamenu access). $li_tag_classes = (array) $variables['element']['#attributes']['class']; $variables['element']['#attributes']['id'] = 'menu-mlid-' . $variables['element']['#original_link']['mlid']; // Copy a tag attributes to li tag (need to have has-separator class on li tag in portal navigation zone). $a_tag_classes = isset($variables['element']['#localized_options']['attributes']['class']) ? (array) $variables['element']['#localized_options']['attributes']['class'] : array(); $li_tag_classes = (array) $variables['element']['#attributes']['class']; $joined_classes = array_merge($a_tag_classes, $li_tag_classes); $variables['element']['#attributes']['class'] = $joined_classes; return theme_menu_link($variables); }
/** * Overrides theme_menu_link(). */ function bootbase_menu_link__admin($vars) { $vars['element']['#localized_options']['attributes']['class'][] = 'tree-item'; return theme_menu_link($vars); }