I'd like to replace the link title on the top link of my secondary navbar (called "explorer", links to "mysite.net/explorer", but actually just triggers a dropdown-menu) with a glyphicon and the current user's name.
According to this thread, a title callback is the way to do this. However, adding this code in my template.php has no effect at all.
function mythemename_menu_alter(&$items) {
$items['explorer']['title callback'] = 'mythemename_title_callback';
}
function mythemename_title_callback($arg1, $arg2) {
global $user;
$title = '<span class="glyphicon glyphicon-user" aria-hidden="true"></span>'. $user->name;
return $title;
}
What am i doing wrong? And why does the callback function take 2 parameters? (It doesn't work with 1 or 0 params.)
The "menu token" module almost crashed my site after installation, so I don't want to use that.