public function ListUsageController::checkAccess in Entity Usage 8.4
Same name and namespace in other branches
- 8 src/Controller/ListUsageController.php \Drupal\entity_usage\Controller\ListUsageController::checkAccess()
- 8.2 src/Controller/ListUsageController.php \Drupal\entity_usage\Controller\ListUsageController::checkAccess()
- 8.3 src/Controller/ListUsageController.php \Drupal\entity_usage\Controller\ListUsageController::checkAccess()
Checks access based on whether the user can view the current entity.
Parameters
string $entity_type: The entity type.
int $entity_id: The entity ID.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
1 call to ListUsageController::checkAccess()
- LocalTaskUsageController::checkAccessLocalTask in src/
Controller/ LocalTaskUsageController.php - Checks access based on whether the user can view the current entity.
1 string reference to 'ListUsageController::checkAccess'
File
- src/
Controller/ ListUsageController.php, line 401
Class
- ListUsageController
- Controller for our pages.
Namespace
Drupal\entity_usage\ControllerCode
public function checkAccess($entity_type, $entity_id) {
$entity = $this->entityTypeManager
->getStorage($entity_type)
->load($entity_id);
if (!$entity || !$entity
->access('view')) {
return AccessResult::forbidden();
}
return AccessResult::allowed();
}