node_access()
node_access(string $op, \Drupal\node\NodeInterface|string|null $node, \Drupal\Core\Session\AccountInterface|object|null $account = null) : bool
Checks node access for an operation, as Drupal 7's node_access() did.
Fails closed: a missing node, an unsupported operation, an unresolvable account or a node
type string with any operation other than "create" returns false. Access is decided by the
node entity access handler, not by Drupal 7's hook_node_access() and node_access table.
Parameters
| string |
$op |
The operation: "view", "update", "delete" or "create".
|
| \Drupal\node\NodeInterface|string|null |
$node |
The node, or a node type ID for "create".
|
| \Drupal\Core\Session\AccountInterface|object|null |
$account |
The account to check, or null for the current user.
|
Returns
bool
— True when access is granted.