2

I'm working on my first subtheme for Zen and ran into a problem. The main menu is being display via tabs. Everything shows up fine, but I have no clue how to allow submenus (or dropdowns, whatever you like) for the items.

Here is how the links are being added to the menu from modules:

$items['node/%node/jobs'] = array(
'title' => 'Jobs',
'page callback' => 'job_applications_form',
'page arguments' => array(1, 'node'),
'access callback' => 'job_applications_user_access',
'access arguments' => array('custom_site_owner', 1),
'type' => MENU_LOCAL_TASK,
'weight' => 100,
);

And here is the code from template.php in Zen that converts the menu items to tabs;

function _menu_local_tasks_output($level = 0, $return_root = FALSE) {
static $tabs;
static $root_path;

if (!isset($tabs)) {
    $tabs = array();

    $router_item = menu_get_item();
    if (!$router_item || !$router_item['access']) {
      return '';
    }

    //kpr($router_item);

    // Get all tabs and the root page.
    $result = db_query("SELECT * FROM {menu_router} WHERE tab_root = '%s' ORDER BY weight, title", $router_item['tab_root']);
    $map = arg();
    $children = array();
    $tasks = array();
    $root_path = $router_item['path'];
    $count = 1;
    $paths = array();
    while ($item = db_fetch_array($result)) 
    {
        //kpr($item);
        _menu_translate($item, $map, TRUE);
        if ($item['tab_root'] != $item['tab_parent'])
        {
            //do nothing
        }
        // Store the item for later use.
        elseif($item['access'])
        {
            if($item['title'] == 'Map Category')
            {
                //do nothing
            }
            elseif($item['title'] == 'Edit')
            {
                //do nothing
            }
            else
            {
                $tasks[$count] = $item;
                $count++;
            }
        }
    }
}
//kpr($paths);
//kpr($tasks);

return theme(array('links__system_main_menu', 'links'), $tasks,
            array(
                'id' => 'main-menu',
                'class' => 'links clearfix',
            ));

}

And finally, the code in page.tpl.php that actually outputs the tabs:

echo '<nav id="navigation" class="clearfix">';
echo '<h1 class="visuallyhidden">Navigation</h1>';
            if($primary_links == 'tabs')
            {
                echo $tabs;
            }
        echo '</nav>';

So, my question is simply this: how can I make it so that when I mouse over Jobs on the menu, a sub menu pops down with different categories? I tried the nice menus module and got it to work with the Primary Links set in the admin panel, but this tabs menu is dynamically created (for each node) by menu hooks in each module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.