function CheckProvider::__construct

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Access/CheckProvider.php \Drupal\Core\Access\CheckProvider::__construct()

Constructs a CheckProvider object.

Parameters

array|null $dynamic_requirements_map: An array to map dynamic requirement keys to service IDs.

\Psr\Container\ContainerInterface|null $container: The check provider service locator.

File

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

Class

CheckProvider
Loads access checkers from the container.

Namespace

Drupal\Core\Access

Code

public function __construct(?array $dynamic_requirements_map = NULL, ?ContainerInterface $container = NULL) {
    $this->dynamicRequirementMap = $dynamic_requirements_map;
    if (is_null($this->dynamicRequirementMap)) {
        @trigger_error('Calling ' . __METHOD__ . ' without the $dynamic_requirements_map argument is deprecated in drupal:10.3.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3416353', E_USER_DEPRECATED);
        $this->dynamicRequirementMap = \Drupal::getContainer()->getParameter('dynamic_access_check_services');
    }
    if (!$this->container) {
        @trigger_error('Calling ' . __METHOD__ . ' without the $container argument is deprecated in drupal:10.3.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3416353', E_USER_DEPRECATED);
        $this->container = \Drupal::getContainer();
    }
}

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