1 book.module _book_get_cached_navigation(array $book_link)

Helper function to get the cached book navigation.

Parameters

array $book_link: A fully loaded menu link that is part of the book hierarchy.

Return value

array: An array of the previous, next, tree and parent links.

File

core/modules/book/book.module, line 1350
Allows users to create and organize related content in an outline.

Code

function _book_get_cached_navigation(array $book_link) {
  $data = FALSE;

  $cid = $book_link['bid'] . ':' . $book_link['mlid'];

  $data = &backdrop_static(__FUNCTION__ . $cid);
  // If not in static cache, check persistent cache.
  if (!$data && $cache = cache_get($cid, 'cache_book')) {
    $data = $cache->data;
  }
  // If not in persistent cache, build the data.
  if (!$data) {
    $prev = book_prev($book_link);
    $next = book_next($book_link);
    $tree = book_children($book_link);
    $parent = book_link_load($book_link['plid']);
    $data = array(
      'prev' => $prev,
      'next' => $next,
      'tree' => $tree,
      'parent' => $parent,
    );
    cache_set($cid, $data, 'cache_book');
  }

  return $data;
}