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.
Comment | File | Size | Author |
---|---|---|---|
#7 | tab_2.patch | 10.89 KB | chx |
#6 | tab_1.patch | 5.75 KB | chx |
#1 | tab_0.patch | 15.97 KB | chx |
tab.patch | 15.88 KB | chx | |
Comments
Comment #1
chx CreditAttribution: chx commentedSchema fix.
Comment #2
Dries CreditAttribution: Dries commentedThe secondary links code could use some code comments, IMO. It's not 100% clear what's going on there.
Comment #3
chx CreditAttribution: chx commentedSecondary links? What secondary links? Ah. Nothing. That needs to be removed, I will reroll later.
Comment #4
webchickNice. 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
Comment #5
chx CreditAttribution: chx commentedInstead 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.
Comment #6
chx CreditAttribution: chx commentedThe 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.
Comment #7
chx CreditAttribution: chx commentedThere 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.
Comment #8
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.
Comment #9
(not verified) CreditAttribution: commented