You are here

public function EntityQueueUIController::access in Entityqueue 8

Checks access for a specific request.

Parameters

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

string $entity_type_id: (optional) The entity type ID.

Return value

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

File

src/Controller/EntityQueueUIController.php, line 266

Class

EntityQueueUIController
Returns responses for Entityqueue UI routes.

Namespace

Drupal\entityqueue\Controller

Code

public function access(RouteMatchInterface $route_match, $entity_type_id = NULL) {

  /** @var \Drupal\Core\Entity\EntityInterface $entity */
  $entity = $route_match
    ->getParameter($entity_type_id);
  if ($entity && $this->entityQueueRepository
    ->getAvailableQueuesForEntity($entity)) {
    return AccessResult::allowed();
  }
  return AccessResult::forbidden();
}