I am trying to include a Bootstrap style dropdown in the local_tasks tabs on a section of my website. I thought I might be able to accomplish this with the 'theme callback' option of 'HOOK_MENU', but it doesn't run the custom callback. Any ideas on a good way to accomplish this?
Menu:
$items['module/submenu/tab'] = array(
'title' => 'Title',
'page callback' => 'mymodule_menu_callback',
'access arguments' => array('access content'),
'theme callback' => 'mymodule_menu_local_task_dropdown',
'type' => MENU_LOCAL_TASK,
);
Callback:
function mymodule_menu_local_task_dropdown($variables) {
$link = $variables['element']['#link'];
$link_text = $link['title'];
$classes = array();
if (!empty($variables['element']['#active'])) {
// Add text to indicate active tab for non-visual users.
$active = '<span class="element-invisible">' . t('(active tab)') . '</span>';
// If the link does not contain HTML already, check_plain() it now.
// After we set 'html'=TRUE the link will not be sanitized by l().
if (empty($link['localized_options']['html'])) {
$link['title'] = check_plain($link['title']);
}
$link['localized_options']['html'] = TRUE;
$link_text = t('!local-task-title!active', array('!local-task-title' => $link['title'], '!active' => $active));
$classes[] = 'active';
}
$classes[] = 'dropdown';
//haven't written this part yet
$dropdown = 'build dropdown';
return '<li class="' . implode(' ', $classes) . '">' . l($link_text, $link['href'], $link['localized_options']) . $dropdown . "</li>\n";
}
What I'm looking for: