function hook_admin_menu_replacements

nittany7 admin_menu.api.php hook_admin_menu_replacements($complete)
cis7 admin_menu.api.php hook_admin_menu_replacements($complete)
mooc7 admin_menu.api.php hook_admin_menu_replacements($complete)

Return content to be replace via JS in the cached menu output.

Parameters

bool $complete: A Boolean indicating whether all available components of the menu will be output and the cache will be skipped.

Return value

array An associative array whose keys are jQuery selectors and whose values are strings containing the replacement content.

1 function implements hook_admin_menu_replacements()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

admin_menu_admin_menu_replacements in modules/contrib/admin_menu/admin_menu.module
Implements hook_admin_menu_replacements().
1 invocation of hook_admin_menu_replacements()
admin_menu_page_build in modules/contrib/admin_menu/admin_menu.module
Implements hook_page_build().

File

modules/contrib/admin_menu/admin_menu.api.php, line 126
API documentation for Administration menu.

Code

function hook_admin_menu_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 = variable_get('admin_menu_components', array());
    if (!empty($components['admin_menu.users']) && ($user_count = admin_menu_get_user_count())) {
      // Replace the counters in the cached menu output with current counts.
      $items['.admin-menu-users a'] = $user_count;
    }
  }
  return $items;
}