public function ReplicateAccessChecker::access in Replicate UI 8
File
- src/
ReplicateAccessChecker.php, line 38
Class
- ReplicateAccessChecker
- Access checker which checks entity create/view access as well a permission.
Namespace
Drupal\replicate_uiCode
public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account) {
$create_fake_route = clone $route;
$create_fake_route
->setRequirement('_entity_access', $route
->getDefault('entity_type_id') . '.create');
$view_fake_route = clone $route;
$view_fake_route
->setRequirement('_entity_access', $route
->getDefault('entity_type_id') . '.create');
$permission_fake_route = clone $route;
$permission_fake_route
->setRequirements([
'_permission' => 'replicate entities',
]);
return $this->entityAccessChecker
->access($view_fake_route, $route_match, $account)
->andIf($this->entityAccessChecker
->access($create_fake_route, $route_match, $account))
->andIf($this->permAccessChecker
->access($permission_fake_route, $account));
}