You are here

function prevent_homepage_deletion_node_access in Prevent homepage deletion 8

Implements hook_node_access().

File

./prevent_homepage_deletion.module, line 35
Code and functions for the Prevent homepage deletion module.

Code

function prevent_homepage_deletion_node_access(EntityInterface $entity, $operation, AccountInterface $account) {
  if ($operation == 'delete') {
    if (!_prevent_homepage_deletion_check($entity, $account)) {
      return AccessResult::forbidden();
    }
    else {
      return AccessResult::neutral();
    }
  }
  return AccessResult::neutral();
}