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().

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

+ we completely prevent rendering on "other" pages, such as print output, popups/dialogs, and other custom pages.

alexkb’s picture

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.

chadvb’s picture

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.

BarisW’s picture

+1 Same here. Appears on IMCE popup window..

BarisW’s picture

Category: task » bug
g10tto’s picture

Also having the IMCE popup window issue.

chellman’s picture

FileSize
1.09 KB

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:

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();
}
chellman’s picture

Status: Active » Needs review

Updated status.

imclean’s picture

chellman's patch in #7 works for me. Cheers.

Status: Needs review » Needs work

The last submitted patch, admin_menu.patch, failed testing.

sun’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Issue tags: +D7 stable release blocker
geerlingguy’s picture

Subscribe. I'd love an easier way to disable the admin_menu on certain pages (especially atypical drupal pages, or pages I embed via an iframe on other sites), than to do a module_invoke() in a custom module's hook_init().

sun’s picture

Title: Move invocation/processing into hook_preprocess_page » Move invocation/processing into hook_page_build()
Category: bug » task
Status: Needs work » Needs review
FileSize
4.56 KB

Let's see whether this passes tests.

sun’s picture

Status: Needs review » Fixed

Totally works. :)

Thanks for reporting, reviewing, and testing! Committed to all branches.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

geerlingguy’s picture

Wonderful!

Status: Fixed » Closed (fixed)
Issue tags: -D7 stable release blocker

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