function CustomAccessCheck::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/Access/CustomAccessCheck.php \Drupal\Core\Access\CustomAccessCheck::__construct()
  2. 8.9.x core/lib/Drupal/Core/Access/CustomAccessCheck.php \Drupal\Core\Access\CustomAccessCheck::__construct()
  3. 11.x core/lib/Drupal/Core/Access/CustomAccessCheck.php \Drupal\Core\Access\CustomAccessCheck::__construct()

Constructs a CustomAccessCheck instance.

Parameters

\Drupal\Core\Utility\CallableResolver|\Drupal\Core\Controller\ControllerResolverInterface $callable_resolver: The callable resolver.

\Drupal\Core\Access\AccessArgumentsResolverFactoryInterface $arguments_resolver_factory: The arguments resolver factory.

File

core/lib/Drupal/Core/Access/CustomAccessCheck.php, line 47

Class

CustomAccessCheck
Defines an access checker that allows specifying a custom method for access.

Namespace

Drupal\Core\Access

Code

public function __construct(ControllerResolverInterface|CallableResolver $callable_resolver, AccessArgumentsResolverFactoryInterface $arguments_resolver_factory) {
    if ($callable_resolver instanceof ControllerResolverInterface) {
        @trigger_error('Calling ' . __METHOD__ . '() with an argument of ControllerResolverInterface is deprecated in drupal:10.3.0 and is removed in drupal:11.0.0. Use \\Drupal\\Core\\Utility\\CallableResolver instead. See https://www.drupal.org/node/3397706', E_USER_DEPRECATED);
        $callable_resolver = \Drupal::service('callable_resolver');
    }
    $this->callableResolver = $callable_resolver;
    $this->argumentsResolverFactory = $arguments_resolver_factory;
}

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