Is there a way to disable the top admin menu (not default toolbar), for a particular page? I am not looking for a JS or CSS workaround, but a proper solution such that the rendering of the admin menu does not happen.
Thanks and help appreciated...
You can assign your admin menu to a block, and have that block disabled on certain pages.
OK, thanks for your replies everyone. But for this specific problem, admin_menu_suppress
actually works perfectly. Idiot that I am, previously, I was calling this function from my page tpl. Hence, the js and css were already getting included even before the content was rendered. However, when I followed the prescribed way of calling the function for each of the page callbacks where I want the admin menu to be excluded, it worked perfectly.
Check the documentation of this function for more details.
Hope this helps somebody...
The module_load_all function loads all of the enabled modules. this is its code:
function module_load_all($bootstrap = FALSE) {
static $has_run = FALSE;
if (isset($bootstrap)) {
foreach (module_list(TRUE, $bootstrap) as $module) {
drupal_load('module', $module);
}
// $has_run will be TRUE if $bootstrap is FALSE.
$has_run = !$bootstrap;
}
return $has_run;
}
Just before the drupal_load('module', $module);
statement check for the specific url you are looking for and the admin-menu
module, if the condition holds skip the drupal_laod
statement. I mean
function module_load_all($bootstrap = FALSE) {
static $has_run = FALSE;
if (isset($bootstrap)) {
foreach (module_list(TRUE, $bootstrap) as $module) {
if(current_path != "SPECIFIC URL" || $module!="SPECIFIC MODULE")
drupal_load('module', $module);
}
// $has_run will be TRUE if $bootstrap is FALSE.
$has_run = !$bootstrap;
}
return $has_run;
}
The How do I prevent a module from being loaded? may also be helpful
Please note that this will require you to hack the core (modify a core source code) and is not recommended unless you have no other option.
admin_menu_suppress
" which when called stops the rendering. But what I want now is not to load the admin menu js and css files. It will save me a lot of page load time.