function NodeRevisionAccessCheck::access
Checks routing access for the node revision.
Parameters
\Symfony\Component\Routing\Route $route: The route to check against.
\Drupal\Core\Session\AccountInterface $account: The currently logged in account.
int $node_revision: (optional) The node revision ID. If not specified, but $node is, access is checked for that object's revision.
\Drupal\node\NodeInterface $node: (optional) A node object. Used for checking access to a node's default revision when $node_revision is unspecified. Ignored when $node_revision is specified. If neither $node_revision nor $node are specified, then access is denied.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
File
- 
              core/modules/ node/ src/ Access/ NodeRevisionAccessCheck.php, line 70 
Class
- NodeRevisionAccessCheck
- Provides an access checker for node revisions.
Namespace
Drupal\node\AccessCode
public function access(Route $route, AccountInterface $account, $node_revision = NULL, NodeInterface $node = NULL) {
  if ($node_revision) {
    $node = $this->nodeStorage
      ->loadRevision($node_revision);
  }
  $operation = $route->getRequirement('_access_node_revision');
  return AccessResult::allowedIf($node && $this->checkAccess($node, $account, $operation))
    ->cachePerPermissions()
    ->addCacheableDependency($node);
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
