function ctools_book_node_ctools_access_check

Check for access.

1 string reference to 'ctools_book_node_ctools_access_check'
book.inc in plugins/access/book.inc
Plugin to provide access control based on whether a node belongs to a book.

File

plugins/access/book.inc, line 50

Code

function ctools_book_node_ctools_access_check($conf, $context) {
  // As far as I know there should always be a context at this point, but this
  // is safe.
  if (empty($context) || empty($context->data) || empty($context->data->book)) {
    return FALSE;
  }
  if ($conf['book']['any']) {
    return !empty($context->data->book);
  }
  foreach ($conf['book'] as $bid => $value) {
    if ($bid == 'any') {
      continue;
    }
    if ($value && $bid == $context->data->book['bid']) {
      return TRUE;
    }
  }
  return FALSE;
}