2

I have created a couple MENU_LOCAL_TASK items for my advanced search page in Drupal 6, but they appear at the end of the tab list on the far right. I would like my new items to appear first in the list of tabs.

Is there an easy way to accomplish this? I tried setting the weight of my new task items to -99 but this appeared to do nothing.

2 Answers 2

3

An easy and correct way is to change the weight as you do. Did you clear menu cache?

3

You can also use hook_menu_alter() to change the weight of the links.

And of course, clear the menu cache.

Here's the snippet.

    /**
     * Implements hook_menu_alter()
     *
     */
    function mymodule_menu_alter(&$items) {

      $new_weight = 10;

      $items['mymenu/path']['weight'] = $new_weight;

    }
1
  • For the benefit of future readers, can you elaborate with a code snippet? Commented Jul 4, 2014 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.