You are here

function admin_menu_footer in Administration menu 5.2

Same name and namespace in other branches
  1. 5.3 admin_menu.module \admin_menu_footer()
  2. 5 admin_menu.module \admin_menu_footer()
  3. 6.3 admin_menu.module \admin_menu_footer()
  4. 6 admin_menu.module \admin_menu_footer()

Implementation of hook_footer().

Admin menu was previously output via hook_block(), but suffered from theme-specific stylesheets that may be applied to layout blocks. We now output Admin menu in the footer to circumvent this.

File

./admin_menu.module, line 174
Renders a menu tree for administrative purposes as dropdown menu at the top of the window.

Code

function admin_menu_footer($main = 0) {
  if (!user_access('access administration menu') || admin_menu_suppress(FALSE)) {
    return;
  }
  global $_menu;

  // Get item id of /q=admin, which we suppose to be the root for admin menu.
  $mid_admin = $_menu['path index']['admin'];
  $_admin_menu =& admin_menu_get_menu($mid_admin);

  // Allow other modules to integrate with admin_menu (uncached).
  foreach (module_implements('admin_menu') as $module) {
    $function = $module . '_admin_menu';
    $function($_admin_menu, FALSE);
  }
  $content = '<div id="admin-menu">';
  $content .= theme_admin_menu_tree($mid_admin);
  $content .= '</div>';
  return $content;
}