function CheckProvider::applies
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Access/CheckProvider.php \Drupal\Core\Access\CheckProvider::applies()
- 10 core/lib/Drupal/Core/Access/CheckProvider.php \Drupal\Core\Access\CheckProvider::applies()
- 11.x core/lib/Drupal/Core/Access/CheckProvider.php \Drupal\Core\Access\CheckProvider::applies()
Determine which registered access checks apply to a route.
Parameters
\Symfony\Component\Routing\Route $route: The route to get list of access checks for.
Return value
array An array of service ids for the access checks that apply to passed route.
1 call to CheckProvider::applies()
- CheckProvider::setChecks in core/
lib/ Drupal/ Core/ Access/ CheckProvider.php - For each route, saves a list of applicable access checks to the route.
File
-
core/
lib/ Drupal/ Core/ Access/ CheckProvider.php, line 124
Class
- CheckProvider
- Loads access checkers from the container.
Namespace
Drupal\Core\AccessCode
protected function applies(Route $route) {
$checks = [];
// Iterate through map requirements from appliesTo() on access checkers.
// Only iterate through all checkIds if this is not used.
foreach ($route->getRequirements() as $key => $value) {
if (isset($this->staticRequirementMap[$key])) {
foreach ($this->staticRequirementMap[$key] as $service_id) {
$this->loadCheck($service_id);
$checks[] = $service_id;
}
}
}
// Finally, see if any dynamic access checkers apply.
foreach ($this->dynamicRequirementMap as $service_id) {
$this->loadCheck($service_id);
if ($this->checks[$service_id]
->applies($route)) {
$checks[] = $service_id;
}
}
return $checks;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.