function book_breadcrumb_test_node_access
Same name in other branches
- 9 core/modules/book/tests/modules/book_breadcrumb_test/book_breadcrumb_test.module \book_breadcrumb_test_node_access()
- 8.9.x core/modules/book/tests/modules/book_breadcrumb_test/book_breadcrumb_test.module \book_breadcrumb_test_node_access()
- 11.x core/modules/book/tests/modules/book_breadcrumb_test/book_breadcrumb_test.module \book_breadcrumb_test_node_access()
Implements hook_ENTITY_TYPE_access().
File
-
core/
modules/ book/ tests/ modules/ book_breadcrumb_test/ book_breadcrumb_test.module, line 16
Code
function book_breadcrumb_test_node_access(NodeInterface $node, $operation, AccountInterface $account) {
$config = \Drupal::config('book_breadcrumb_test.settings');
if ($config->get('hide') && $node->getTitle() == "you can't see me" && $operation == 'view') {
$access = new AccessResultForbidden();
}
else {
$access = new AccessResultNeutral();
}
$access->addCacheableDependency($config);
$access->addCacheableDependency($node);
return $access;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.