You are here

function admin_menu_footer in Administration menu 5

Same name and namespace in other branches
  1. 5.3 admin_menu.module \admin_menu_footer()
  2. 5.2 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 53

Code

function admin_menu_footer($main) {
  if (!user_access('access administration menu')) {
    return;
  }
  global $user, $locale;
  $cid = $user->uid . ':' . $locale . ':admin_menu';
  $cache = cache_get($cid, 'cache_menu');
  if ($cache) {
    $admin_menu = $cache->data;
  }
  else {
    require_once drupal_get_path('module', 'admin_menu') . '/admin_menu.inc';
    $admin_menu = admin_menu_get_menu();
    cache_set($cid, 'cache_menu', $admin_menu, time() + 60 * 60 * 24);
  }
  $content = '<div id="admin_menu">';
  $content .= theme('admin_menu_icon');
  $content .= $admin_menu;
  $content .= '</div>';
  return $content;
}