While writing about general theme hooks that module developers could re-use, I ran across theme_submenu(). “WTF is that?” I thought.
I did some digging in discovered it was added in Drupal 4.5 with this commit: http://drupalcode.org/viewvc/drupal/drupal/includes/theme.inc?revision=1...
Tabs patch!
CHANGES
-------+ Introduced tabs. First, we extended the menu system to support tabs. Next, a tab was added for every link that was (1) an administrative action other than the implicit 'view' (2) relevant to that particular page only. This is illustrated by the fact that all tabs are verbs and that clicking a page's tab leads you to a subpage of that page.
+ Flattened the administration menu. The tabs helped simplify the navigation menu as I could separate 'actions' from 'navigation'. In addition, I removed the 'administer > configuration'-menu, renamed 'blocks' to 'sidebars' which I hope is a bit more descriptive, and made a couple more changes. Earlier, we already renamed 'taxonomy' to 'categorization' and we move 'statistics' under 'logs'.
+ Grouped settings. All settings have been grouped under 'administer > settings'.
TODO
----+ Update core themes: only Xtemplate default supports tabs and even those look ugly. Need help.
+ Update contributed modules. The menu() hook changed drastically. Updating your code adhere the new menu() function should be 90% of the work. Moreover, ensure that your modue's admin links are still valid and that URLs to node get updated to the new scheme ('node/view/x' -> 'node/x').
There's no corresponding issue #, so I couldn't find any discussion about the patch. But using bzr, I was able to re-create the committed patch which I have attached for reference.
As you can see theme_submenu() was added in the patch, but so was theme_menu_local_tasks() and theme_menu_local_subtasks(). theme_menu_local_subtasks() was responsible for rendering sub-menu links of tabs and was later merged into theme_menu_local_tasks() before 4.5 was released.
I searched through the entire core codebase in D4.5, D4.6, D4.7, D5, D6 and D7. And as far as I can tell, theme_submenu() WAS NEVER USED. Ever.
But we have faithfully upgraded it all the way through Drupal 7 alpha 2. heh.
Comment | File | Size | Author |
---|---|---|---|
#2 | theme-submenu-byebye-721556-2.patch | 1.09 KB | JohnAlbin |
#1 | tabs-DRUPAL-4-5.patch | 691.74 KB | JohnAlbin |
Comments
Comment #1
JohnAlbinHere's the re-created Drupal 4.5 patch.
Comment #2
JohnAlbinAnd here's the patch to remove theme_submenu() from core.
Comment #3
JohnAlbinA search for
theme('submenu'
returns no results in Google's code search: http://www.google.com/codesearch?q=%22theme%28%27submenu%27%22Ditto with a search on krugle. No results.
Comment #4
Dries CreditAttribution: Dries commentedNice catch. I can't imagine how many CPU cycle this function has wasted since it was introduced. Committed to CVS HEAD.
Comment #6
Gábor HojtsyThis was not documented in the update docs: added http://drupal.org/update/theme/6/7#theme-submenu