Drupal $tabs not including edit / revisions / workflow

1k views Asked by At

I inherited a Drupal5 site and have been tasked with making some changes, but I'm unable to figure out where to start looking.

On many pages there is a menu available to administrators that allows you do do certain actions:

Overview Specialists Resources and Tools In the Field News Events Courses Multimedia Edit Track Workflow Settings

However, on some sections, there are different options: Preview Layout Settings Layout settings Advanced Context Content Export

I need to add (Edit, Track, Workflow, Settings) to the second menu, but I'm not sure how to do that.

I see in page.tpl.php there is region for $tabs, but I can't figure out how this gets built.

From what I can tell, the theme is based on the Zen STARTERKIT theme.

2

There are 2 answers

0
Henrik Opel On BEST ANSWER

The $tabs variable normally gets populated with menu entries of type MENU_LOCAL_TASK.

Take a look at the menu system, and especially at hook_menu() to get a basic idea. It boils down to a mapping of callback functions to paths. If an URL matches a path defined in hook_menu (can contain placeholders!), the callback function registered for that path will be called to generate the content for that URL.

The 'type' of the hook_menu item defines how the path/callback combination is represented in the system. It can be a MENU_CALLBACK, which would mean just the registered path/callback combination, but no corresponding 'real' menu entry. A MENU_NORMAL_ITEM, would be the same, but with a 'standard' menu entry, e.g. in the navigation menu. A MENU_LOCAL_TASK is the same, but the corresponding menu entry usually shows up in the $tabs and not in a menu.

All MENU_LOCAL_TASK that share the same base path will end up as a group of tabs. So if you had paths like:

  • some/path/tab1
  • some/path/tab2
  • some/path/tab3

and all of these where defined as MENU_LOCAL_TASK, you would see one tab for each of them on each page they represent.

So to find the places you need to modify/enhance, you should search your codebase for all hook_menu() implementations that define the paths where those tabs show up. Note that they need not all be defined at the same place, but could come from different hook_menu implementations in different modules. Than you'd need to add menu definitions for the tabs you want to add, mapping the relevant paths to callback functions. The callback functions would return the content of the pages that the user should see when clicking the tabs.

0
bas On

If you are displaying node, usually there is already the Edit link in the $tabs, since its not present that might be something else (some kind of layout module). You need to add Edit/ Track options to edit/track what kind of content? Specific node or what?