You are here

public function CheckProvider::addCheckService in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Access/CheckProvider.php \Drupal\Core\Access\CheckProvider::addCheckService()

Registers a new AccessCheck by service ID.

Parameters

string $service_id: The ID of the service in the Container that provides a check.

string $service_method: The method to invoke on the service object for performing the check.

array $applies_checks: (optional) An array of route requirement keys the checker service applies to.

bool $needs_incoming_request: (optional) True if access-check method only acts on an incoming request.

Overrides CheckProviderInterface::addCheckService

File

core/lib/Drupal/Core/Access/CheckProvider.php, line 63
Contains \Drupal\Core\Access\CheckProvider.

Class

CheckProvider
Loads access checkers from the container.

Namespace

Drupal\Core\Access

Code

public function addCheckService($service_id, $service_method, array $applies_checks = array(), $needs_incoming_request = FALSE) {
  $this->checkIds[] = $service_id;
  $this->checkMethods[$service_id] = $service_method;
  if ($needs_incoming_request) {
    $this->checksNeedsRequest[$service_id] = $service_id;
  }
  foreach ($applies_checks as $applies_check) {
    $this->staticRequirementMap[$applies_check][] = $service_id;
  }
}