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.

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;

    }
  • For the benefit of future readers, can you elaborate with a code snippet? – David Thomas Jul 4 '14 at 7:28

Your Answer

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

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