You are here

public function ViewsBulkOperationsAccess::access in Views Bulk Operations (VBO) 4.0.x

Same name and namespace in other branches
  1. 8.3 src/Access/ViewsBulkOperationsAccess.php \Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess::access()
  2. 8 src/Access/ViewsBulkOperationsAccess.php \Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess::access()
  3. 8.2 src/Access/ViewsBulkOperationsAccess.php \Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess::access()

A custom access check.

Parameters

\Drupal\Core\Session\AccountInterface $account: Run access checks for this account.

\Drupal\Core\Routing\RouteMatch $routeMatch: The matched route.

File

src/Access/ViewsBulkOperationsAccess.php, line 39

Class

ViewsBulkOperationsAccess
Defines module access rules.

Namespace

Drupal\views_bulk_operations\Access

Code

public function access(AccountInterface $account, RouteMatch $routeMatch) {
  $parameters = $routeMatch
    ->getParameters()
    ->all();
  if ($view = Views::getView($parameters['view_id'])) {
    if ($view
      ->access($parameters['display_id'], $account)) {
      return AccessResult::allowed();
    }
  }
  return AccessResult::forbidden();
}