This is step one. There are more steps to be taken but this will reestablish first level tabs to HEAD. The new tab rule is

For a non-tab item, the immediate children of the current path are considered as tabs.
For an item that is tab, the immediate siblings of the current path are considered as tabs. Ie. the immediate children of the parent are considered as tabs.

These rules will be adjusted when the N-level of tabs will be introduced. Stay tuned.

Drupal 5 makes very bold assumptions. Imagine this scenario: someone creates a module which adds a sub-menu item under admin/content/taxonomy named after the vocabulary and makes the path the name of the vocabulary, pathauto like. Now, someone adds a vocabulary for Attention-deficit hyperactivity disorder, thus the path admin/content/taxonomy/add is created. Now, the default path for adding a vocabulary is admin/content/taxonomy/add/vocabulary... and that will nicely disappear from admin/content/taxonomy and will try to appear under admin/content/taxonomy/add but being a single tab it won't appear.

The new rules does not allow such anomalies. So, I needed to adjust some admin paths to match the new rules (note: there were hardly any set-out rules for the old system).

So, N-th level of tabs are the next easy step. n previous Drupal versions we had only two, but that's artificial and I had a contract once to develop a third level. Now, if you look at the second rule above you will quickly realise that this one iterates upwards.

A very tough case is tracker. Here, you have a tab that points to tracker/%. Howevever, that % means 'the uid of the current user, unlike from node/% or user/% type paths where % in the tab paths are simply arg(1). This will be solved by Eaton's token system which is also needed for better breadcrumb solutions in core. It's lightweight and all, but that's a separate issue.

CommentFileSizeAuthor
#7 tab_2.patch10.89 KBchx
#6 tab_1.patch5.75 KBchx
#1 tab_0.patch15.97 KBchx
tab.patch15.88 KBchx
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chx’s picture

FileSize
15.97 KB

Schema fix.

Dries’s picture

The secondary links code could use some code comments, IMO. It's not 100% clear what's going on there.

chx’s picture

Secondary links? What secondary links? Ah. Nothing. That needs to be removed, I will reroll later.

webchick’s picture

Status: Needs review » Needs work

Nice. Drupal starts to look a lot more like Drupal with this patch. ;) As with other menu changes, there is no upgrade path, so best tested from a clean install.

Some missing tabs I notice:
- ?=user - no edit/contact tabs.
- no way to get to "my recent posts" in tracker (already identified)
- add container and add forum tabs in ?q=admin/content/forum
- add category and add feed tabs in ?q=admin/content/aggregator
- content and users tab on ?q=search

chx’s picture

Instead of the tab rule, I will introduce parents, this solves the fluid search problems nicely. The tab rule will be the default parents. tracker/% will not be solved in this round, a hook_menu_helper will solve that and that will replace map callback, too.

chx’s picture

FileSize
5.75 KB

The tab rule now only defines the default parent. I changed taxonomy to show two examples when the default is not good enough. webchick volunteered to inspect all other tabs in core.

chx’s picture

Status: Needs work » Needs review
FileSize
10.89 KB

There are paths that need to dynamically crafted like user/% when standing on user, tracker/%, search/node/% when searching something. These are not fixed in this round. I will define a hook_menu_helper which will be able to help you define these and will swallow map callback.

All other tabs should be there.

Dries’s picture

Status: Needs review » Fixed

Committed to CVS HEAD. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)