I have an 'audience' menu which has 4 links. When a user visits one of these links, it becomes active, and I want to push it to the front of the menu item list. Outcomes would like like;
Pitchers | Catchers | Hitters | Coaches
Coaches (active) | Pitchers | Catchers | Hitters
Catchers (active) | Pitchers | Hitters | Coaches
Hitters (active) | Pitchers | Catchers | Coaches
How can I accomplish this programmatically? I can't seem to find the right theme_ or hook_ api function to pull this off.
I've tried this, and changing the '#original_link' weight didn't seem to make a difference (note, I have other things going on here):
function apple_menu_link__menu_audience_gateway(&$vars) {
$element = $vars['element'];
$submenu = '';
if($element['#original_link']['in_active_trail'] == TRUE) {
$element['#original_link']['weight'] = 50;
}
if ($element['#below']) {
unset($element['#below']['#theme_wrappers']);
$submenu = '<ul class="nav">' . drupal_render($element['#below']) . '</ul>';
}
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $submenu . '</li>';
}
Also, I'm using Panels, Panels Everywhere, Page Manager, and MiniPanels — this could inform the ultimate solution.
Thanks all.