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

sun - June 25, 2009 - 20:47

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

#2

alexkb - September 7, 2009 - 03:00

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

chadvb - September 10, 2009 - 12:48

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

BarisW - September 22, 2009 - 12:46

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

#5

BarisW - September 22, 2009 - 12:46
Category:task» bug report

#6

g10tto - September 23, 2009 - 14:47

Also having the IMCE popup window issue.

#7

chellman - October 20, 2009 - 15:58

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();
}
?>

AttachmentSize
admin_menu.patch 1.09 KB

#8

chellman - October 21, 2009 - 15:32
Status:active» needs review

Updated status.

 
 

Drupal is a registered trademark of Dries Buytaert.