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!


+ 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'.


+ 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.

#2 theme-submenu-byebye-721556-2.patch1.09 KBJohnAlbin
PASSED: [[SimpleTest]]: [MySQL] 17,906 pass(es). View
#1 tabs-DRUPAL-4-5.patch691.74 KBJohnAlbin
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch tabs-DRUPAL-4-5_0.patch. View


JohnAlbin’s picture

691.74 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch tabs-DRUPAL-4-5_0.patch. View

Here's the re-created Drupal 4.5 patch.

JohnAlbin’s picture

Status:Active» Needs review
1.09 KB
PASSED: [[SimpleTest]]: [MySQL] 17,906 pass(es). View

And here's the patch to remove theme_submenu() from core.

JohnAlbin’s picture

A search for theme('submenu' returns no results in Google's code search: http://www.google.com/codesearch?q=%22theme%28%27submenu%27%22

Ditto with a search on krugle. No results.

Dries’s picture

Status:Needs review» Fixed

Nice catch. I can't imagine how many CPU cycle this function has wasted since it was introduced. Committed to CVS HEAD.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Gábor Hojtsy’s picture

This was not documented in the update docs: added http://drupal.org/update/theme/6/7#theme-submenu