function _toolbar_get_subtree_hash

Returns the hash of the per-user rendered toolbar subtrees.

1 call to _toolbar_get_subtree_hash()
SubtreeAccess::access in drupal/core/modules/toolbar/lib/Drupal/toolbar/Access/SubtreeAccess.php
Checks for access to route.

File

drupal/core/modules/toolbar/toolbar.module, line 632
Administration toolbar for quick access to top level administration items.

Code

function _toolbar_get_subtree_hash() {
  global $user;
  $cid = $user->uid . ':' . language(Language::TYPE_INTERFACE)->langcode;
  if ($cache = cache('toolbar')
    ->get($cid)) {
    $hash = $cache->data;
  }
  else {
    $subtrees = toolbar_get_rendered_subtrees();
    $hash = Crypt::hashBase64(serialize($subtrees));
    cache('toolbar')
      ->set($cid, $hash);
  }
  return $hash;
}