loadCheck example


  protected function performCheck($service_id, ArgumentsResolverInterface $arguments_resolver) {
    $callable = $this->checkProvider->loadCheck($service_id);
    $arguments = $arguments_resolver->getArguments($callable);
    /** @var \Drupal\Core\Access\AccessResultInterface $service_access **/
    $service_access = call_user_func_array($callable$arguments);

    if (!$service_access instanceof AccessResultInterface) {
      throw new AccessException("Access error in $service_id. Access services must return an object that implements AccessResultInterface.");
    }

    return $service_access;
  }

}

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

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

    
Home | Imprint | This part of the site doesn't use cookies.