You are here

function hook_admin_menu_replacements in Administration menu 7.3

Same name and namespace in other branches
  1. 8.3 admin_menu.api.php \hook_admin_menu_replacements()

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 ./admin_menu.module
Implements hook_admin_menu_replacements().
1 invocation of hook_admin_menu_replacements()
admin_menu_page_build in ./admin_menu.module
Implements hook_page_build().

File

./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;
}