1 admin_bar.module admin_bar_admin_bar_replacements($complete)

Implements hook_admin_bar_replacements().

File

core/modules/admin_bar/admin_bar.module, line 383
Render an administrative bar as a dropdown menu at the top of the window.

Code

function admin_bar_admin_bar_replacements($complete) {
  $items = array();
  // If the complete menu is output, then it is uncached and will contain the
  // current counts already.
  if (!$complete) {
    // Check whether the users count component is enabled.
    $components = config_get('admin_bar.settings', 'components');
    if (in_array('admin_bar.users', $components) && ($user_count = admin_bar_get_user_count())) {
      // Replace the counters in the cached menu output with current counts.
      $items['.admin-bar-users a'] = $user_count;
    }
  }
  return $items;
}