0

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

  • I found a function in the module called "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. – Pratip Ghosh Apr 24 '15 at 11:51
  • 1
    If your question changed, please edit it. This site is not a forum. Comments are second-class citizens, and only content that is directly in question should be considered when answering. Your comment may get deleted without notification and no one will care. – Mołot Apr 24 '15 at 12:31
  • Molot, this is not a change of question. I just found a solution that I wanted to share, but as that didnt gave me the optimized solution, hence posted it as a comment. – Pratip Ghosh Apr 24 '15 at 14:01
  • answers should be posted as answers, even if they aren't the best ones :) – Mołot Apr 24 '15 at 14:03
  • If this is only temporarily, I use the Admin menu hider: drupal.org/project/admin_menu_dropdown. Very handy if you do screen shots or test a site in mobile mode without having to log out first. It uses a key-press to hide. There is also the toolbar menu hider module for the default Drupal toolbar. – Quentin Campbell Apr 25 '15 at 11:13
0

You can assign your admin menu to a block, and have that block disabled on certain pages.

0

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

  • You will need to mark your answer as Approved. – Alexar Apr 25 '15 at 7:22
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.