You are here

function admin_menu_cache_get in Administration menu 8.3

Same name and namespace in other branches
  1. 5.3 admin_menu.module \admin_menu_cache_get()
  2. 6.3 admin_menu.module \admin_menu_cache_get()

Retrieve a client-side cache hash from cache.

The hash cache is consulted more than once per request; we therefore cache the results statically to avoid multiple database requests.

This should only be used for client-side cache hashes. Use cache_menu for administration menu content.

Parameters

$cid: The cache ID of the data to retrieve.

1 call to admin_menu_cache_get()
admin_menu_page_bottom in ./admin_menu.module
Implements hook_page_bottom().
1 string reference to 'admin_menu_cache_get'
admin_menu_cache_flush in ./admin_menu.module
Implements hook_cache_flush().

File

./admin_menu.module, line 301
Render an administrative menu as a dropdown menu at the top of the window.

Code

function admin_menu_cache_get($cid) {
  $cache =& drupal_static(__FUNCTION__, []);
  if (!variable_get('admin_menu_cache_client', TRUE)) {
    return FALSE;
  }
  if (!array_key_exists($cid, $cache)) {
    $cache[$cid] = cache('admin_menu')
      ->get($cid);
    if ($cache[$cid] && isset($cache[$cid]->data)) {
      $cache[$cid] = $cache[$cid]->data;
    }
  }
  return $cache[$cid];
}