As one is able to see in the Drupal Administration Menu Showcase, most themes fail to implement a header region in which the admin menu block could be output to use all available browser window width and by-pass any stylesheet selectors for blocks or menus.

We've implemented a nice banner in this demo that is injected into all themes as first HTML element directly after the BODY tag. As you can see in the showcase, that banner is often (not always, but more often than admin menu) rendered at the appropriate position.

Unfortunately, we cannot implement admin menu exactly the same way, because it would be loaded and rendered in all pages (f.e. popup windows). However, we should be able to completely move the admin menu container from the block to the body. That should be a one-liner in jQuery.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

Status: Active » Needs review
FileSize
3.32 KB

Attached patch moves relevant code into hook_menu() and hook_footer(). No additional javascript required. Look into the patch for further information.

You can see this patch in action in the Drupal Administration Menu showcase. A few themes did not output $closure [hook_footer()] and needed to be fixed. However, that's a lot easier than overriding all possible stylesheets that may have been applied to blocks or implementing a new admin_menu region.

Only known caveat: Since hook_footer() is invoked after all blocks (including menu blocks) are rendered, the 'administer' menu item is not removed from the menu block. It is also not removable in hook_menu(), since the global $_menu array is actually built there. Currently, I'm not aware of any hook that is invoked between hook_menu() and hook_block().
Of course, users could move the 'administer' item to another menu.

drutube’s picture

Sorry . but to actually see what I mean you have to open the collapsed fields. Try to add content ect.

Crimson’s picture

Status: Needs review » Reviewed & tested by the community

I've tested out and it works great. No problems so far. Can I change the status to "ready to be committed"?

sun’s picture

@crimson: Thanks for your review!

Because this patch changes the inclusion of admin_menu in a theme, I'm currently unsure, if this should go into the existing 1.x branch as a bug fix or into a new 2.x branch. Some custom themes may not (yet) output $closure, so admin_menu would no longer be displayed. Thus, if someone decided to move the 'administer' tree into a new menu and did not enable that menu block, a site could become (temporarily) unmaintainable...

I appreciate any comments on this.

sun’s picture

Status: Reviewed & tested by the community » Fixed
FileSize
3.94 KB

Committed attached patch.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Where do I install the patch? and do I copy it into a notepad file and upload it like that or cut and paste the patch into a file? Thanks - I'm a newbie!