Move invocation/processing into hook_preprocess_page
sun - June 25, 2009 - 20:45
| Project: | Administration menu |
| Version: | 6.x-3.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
By moving from hook_init() into hook_preprocess_page() we
- can skip JS settings and client-side caching completely on pages that want to suppress admin_menu
- only add admin_menu to pages. Doesn't make sense elsewhere.
- make that whole stuff cleaner.
Perhaps we can even eliminate hook_footer().

#1
+ we completely prevent rendering on "other" pages, such as print output, popups/dialogs, and other custom pages.
#2
Hi Sun,
Firstly, let me say, great module!
Anyway, I just wanted to know when things would be fixed so that the menu didn't show up on imce popups as per the reported duplicate issue here: #540120: "Administration menu" appears on some popups. Or is this for the imce or imce_wysiwyg module developers to make adaptions to. I'm using admin_menu-6.x-3.0-alpha3.
Thanks.
#3
I am having the same issue as alexkb which is a real drag. I'm not a developer so I'm hoping you could explain a little more how to implement this change to clear up the issue.
#4
+1 Same here. Appears on IMCE popup window..
#5
#6
Also having the IMCE popup window issue.
#7
Here's a patch that seems to work for me in limited testing. All I've done is move everything from admin_menu_init() into admin_menu_preprocess_page() and added a couple lines. After clearing the Drupal cache, admin menu shows up again normally, but not on IMCE (which is right, I think).
Meantime, the IMCE issue can be solved by modifying imce/inc/page.inc:
<?php
function imce_page() {
$jsop = isset($_GET['jsop']) ? $_GET['jsop'] : NULL;
// disable admin_menu here
module_invoke('admin_menu', 'suppress');
print theme('imce_page', imce_content($GLOBALS['user'], $jsop));
exit();
}
?>
#8
Updated status.