You are here

public function ChecklistapiAccessCheck::access in Checklist API 8

Checks routing access for the checklist.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match.

Return value

\Drupal\Core\Access\AccessResult Returns an access result.

File

src/Access/ChecklistapiAccessCheck.php, line 23

Class

ChecklistapiAccessCheck
An access check service for checklist routes.

Namespace

Drupal\checklistapi\Access

Code

public function access(RouteMatchInterface $route_match) {
  $op = $route_match
    ->getParameter('op') ?: 'any';
  $id = $route_match
    ->getParameter('checklist_id');
  if (!$id) {
    return AccessResult::neutral();
  }
  return AccessResult::allowedIf(checklistapi_checklist_access($id, $op));
}