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.
Comment | File | Size | Author |
---|---|---|---|
#5 | admin_menu-DRUPAL-5.theme_.patch | 3.94 KB | sun |
#1 | admin_menu-DRUPAL-5.theme_.patch | 3.32 KB | sun |
Comments
Comment #1
sunAttached 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.
Comment #2
drutube CreditAttribution: drutube commentedSorry . but to actually see what I mean you have to open the collapsed fields. Try to add content ect.
Comment #3
Crimson CreditAttribution: Crimson commentedI've tested out and it works great. No problems so far. Can I change the status to "ready to be committed"?
Comment #4
sun@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.
Comment #5
sunCommitted attached patch.
Comment #6
(not verified) CreditAttribution: commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedWhere 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!