public function ListUsageController::checkAccess in Entity Usage 8
Same name and namespace in other branches
- 8.4 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 $type: The entity type.
int $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 192
Class
- ListUsageController
- Controller for our pages.
Namespace
Drupal\entity_usage\ControllerCode
public function checkAccess($type, $id) {
$entity = $this->entityTypeManager
->getStorage($type)
->load($id);
if (!$entity || !$entity
->access('view')) {
return AccessResult::forbidden();
}
return AccessResult::allowed();
}