Does not work with Drupal 7's theme_menu_link function

Created on 21 March 2012, over 12 years ago
Updated 2 May 2024, about 2 months ago

I want to wrap my menu link titles in span tags. So I implement the theme_menu_link function in my template.php. However, that doesn't have any effect on menus displayed using Nice Menus. So I need to add a second function. I have to implement the special theme_nice_menus_menu_item_link function just to get the same functionality for my Nice Menus.

My template.php for my test theme ends up looking like this:

function test_menu_link($vars) {
  $vars['element']['#title'] = '<span>' . $vars['element']['#title'] . '</span>';
  $vars['element']['#localized_options']['html'] = TRUE;
  return theme_menu_link($vars);
}

function test_nice_menus_menu_item_link($vars) {
  $vars['element']['#title'] = '<span>' . $vars['element']['#title'] . '</span>';
  $vars['element']['#localized_options']['html'] = TRUE;
  return theme_nice_menus_menu_item_link($vars);
}

Nice Menus should instead work with the standard theme_menu_link function.

πŸ› Bug report
Status

Closed: outdated

Version

2.1

Component

Theme Compat

Created by

πŸ‡ΊπŸ‡ΈUnited States dkingofpa

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024