2

I have a set of local task menu items defined in my module. This includes the following items:

  • control => MENU_NORMAL_ITEM
  • control/jobs => MENU_DEFAULT_LOCAL_TASK
  • control/jobs/% => MENU_???
  • control/download => MENU_LOCAL_TASK
  • control/settings => MENU_LOCAL_TASK

The three menu items (jobs, download and settings), display as tabs, as I want. When someone clicks through to see a particular job, I want this to show as having the jobs tab selected.

If I add MENU_LOCAL_TASK to "control/jobs/%," the tabs show up, but I get notice errors (because Drupal is trying to define a link to % and can't know that). If I don't, the specific job page does not have any tabs at the top.

Have I misunderstood anything? Can I achieve this in another way?

0

You can do what you want, but you need to change the url structure a bit. If I understand you correctly:

  • control/jobs: List of all jobs, should be MENU_NORMAL_ITEM
  • control/jobs/%node (You should have a load function for the job, if not a node than something else), should be MENU_NORMAL_ITEM
  • control/jobs/%node/view: MENU_DEFAULT_LOCAL_TASK (doesn't have a callback)
  • control/jobs/%node/download: The download page for a specific job, MENU_LOCAL_TASK
  • control/jobs/%node/settings: The settings page for a specific job, MENU_LOCAL_TASK

You can take a look at the node and user module to get an idea on how create tabs in Drupal

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.