Deny node access depending on field value I'm trying to restrict the access to nodes of type article depending on a field value of the node. When I implement hook_node_access() it seems to have no effect on the node.

Even if I try to restrict the whole access it seems to have no effect.

function mymodule_node_access($node, $op, $account) {
  $type = $node-&gt;getType();
  if ($type == 'article') {
    return AccessResult::isForbidden;
  }
}


What's my mistake?
With what user do you check the access, as stated in the docs


  The administrative account (user ID #1) always passes any access
  check, so this hook is not called in that case. Users with the "bypass
  node access" permission may always view and edit content through the
  administrative interface.


user 1 will always have access ..

Make sure to check with an anonymous or regular user.