function CheckProvider::loadDynamicRequirementMap

Same name in other branches
  1. 9 core/lib/Drupal/Core/Access/CheckProvider.php \Drupal\Core\Access\CheckProvider::loadDynamicRequirementMap()
  2. 10 core/lib/Drupal/Core/Access/CheckProvider.php \Drupal\Core\Access\CheckProvider::loadDynamicRequirementMap()
  3. 11.x core/lib/Drupal/Core/Access/CheckProvider.php \Drupal\Core\Access\CheckProvider::loadDynamicRequirementMap()

Compiles a mapping of requirement keys to access checker service IDs.

1 call to CheckProvider::loadDynamicRequirementMap()
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 149

Class

CheckProvider
Loads access checkers from the container.

Namespace

Drupal\Core\Access

Code

protected function loadDynamicRequirementMap() {
    if (isset($this->dynamicRequirementMap)) {
        return;
    }
    // Set them here, so we can use the isset() check above.
    $this->dynamicRequirementMap = [];
    foreach ($this->checkIds as $service_id) {
        if (empty($this->checks[$service_id])) {
            $this->loadCheck($service_id);
        }
        // Add the service ID to an array that will be iterated over.
        if ($this->checks[$service_id] instanceof AccessCheckInterface) {
            $this->dynamicRequirementMap[] = $service_id;
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.