Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291026

theme_menu_link isn't called on main menu and secondary menu.

$
0
0

When using a theme hook to alter menus, it works in blocks and other places menus may appear but not on the main menu and secondary links.

Use this demonstration code in a template.php then test the menu with the "My Account" link in both a block and the main menu to see the difference.

function mytheme_menu_link(array $variables) {
global $user;

if($variables['element']['#href'] == "user"){
$variables['element']['#title'] = "Hi ".$user->name;
}

return theme_menu_link($variables);
}
As the main menu and secondary menu are created from the menu system I would assume this hook should apply to them.

Viewing all articles
Browse latest Browse all 291026

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>