You are here

public function LatestRevisionCheck::access in Access unpublished 8

Checks that there is a pending revision available.

This checker assumes the presence of an '_entity_access' requirement key in the same form as used by EntityAccessCheck.

Parameters

\Symfony\Component\Routing\Route $route: The route to check against.

\Drupal\Core\Routing\RouteMatchInterface $route_match: The parametrized route.

\Drupal\Core\Session\AccountInterface $account: The current user account.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

Overrides LatestRevisionCheck::access

See also

\Drupal\Core\Entity\EntityAccessCheck

File

src/Access/LatestRevisionCheck.php, line 53

Class

LatestRevisionCheck
Access check for the entity moderation tab which supports access_unpublished.

Namespace

Drupal\access_unpublished\Access

Code

public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account) {

  /** @var \Drupal\Core\Access\AccessResultInterface $access */
  $access = $this->accessCheck
    ->access($route, $route_match, $account);
  $entity = $this
    ->loadEntity($route, $route_match);
  return $access
    ->orIf(access_unpublished_entity_access($entity, 'view', $account));
}