function unpublished_node_permissions_node_access in Unpublished Node Permissions 8
Implements hook_node_access().
File
- ./
unpublished_node_permissions.module, line 24 - Contains unpublished_node_permissions.module.
Code
function unpublished_node_permissions_node_access(NodeInterface $node, $op, $account) {
$type = $node
->bundle();
if ($op == 'view' && !$node
->isPublished()) {
return AccessResult::allowedIfHasPermission($account, 'view ' . $type . ' unpublished content');
}
return AccessResult::neutral();
}