You are here

public function LocalTaskUsageController::checkAccessLocalTask in Entity Usage 8

Same name and namespace in other branches
  1. 8.4 src/Controller/LocalTaskUsageController.php \Drupal\entity_usage\Controller\LocalTaskUsageController::checkAccessLocalTask()
  2. 8.2 src/Controller/LocalTaskUsageController.php \Drupal\entity_usage\Controller\LocalTaskUsageController::checkAccessLocalTask()
  3. 8.3 src/Controller/LocalTaskUsageController.php \Drupal\entity_usage\Controller\LocalTaskUsageController::checkAccessLocalTask()

Checks access based on whether the user can view the current entity.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: A RouteMatch object.

Return value

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

File

src/Controller/LocalTaskUsageController.php, line 22

Class

LocalTaskUsageController
Controller for our local tasks.

Namespace

Drupal\entity_usage\Controller

Code

public function checkAccessLocalTask(RouteMatchInterface $route_match) {
  $entity = $this
    ->getEntityFromRouteMatch($route_match);
  return parent::checkAccess($entity
    ->getEntityTypeId(), $entity
    ->id());
}