CheckProvider::applies

protected CheckProvider::applies(Route $route)

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.

File

core/lib/Drupal/Core/Access/CheckProvider.php, line 124

Class

CheckProvider
Loads access checkers from the container.

Namespace

Drupal\Core\Access

Code

protected function applies(Route $route) {
  $checks = array();

  // 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) {
        $checks[] = $service_id;
      }
    }
  }
  // Finally, see if any dynamic access checkers apply.
  foreach ($this->dynamicRequirementMap as $service_id) {
    if ($this->checks[$service_id]->applies($route)) {
      $checks[] = $service_id;
    }
  }

  return $checks;
}
doc_Drupal
2016-10-29 08:49:57
Comments
Leave a Comment

Please login to continue.