You are here

function _book_access_get_book_nid in Book access 5

Returns the very top level (book) nid for a given book page.

1 call to _book_access_get_book_nid()
book_access_node_access_records in ./book_access.module
Implements hook_node_access_records().

File

./book_access.module, line 328
Allows access control for Drupal book nodes.

Code

function _book_access_get_book_nid($nid) {
  $parents = _book_access_get_parents();
  if ($parents[$nid] == 0) {
    return $nid;
  }
  return _book_access_get_book_nid($parents[$nid]);
}