PathValidator::getPathAttributes

protected PathValidator::getPathAttributes($path, Request $request, $access_check)

Gets the matched attributes for a given path.

Parameters

string $path: The path to check.

\Symfony\Component\HttpFoundation\Request $request: A request object with the given path.

bool $access_check: If FALSE then skip access check and check only whether the path is valid.

Return value

array|bool An array of request attributes of FALSE if an exception was thrown.

File

core/lib/Drupal/Core/Path/PathValidator.php, line 147

Class

PathValidator
Provides a default path validator and access checker.

Namespace

Drupal\Core\Path

Code

protected function getPathAttributes($path, Request $request, $access_check) {
  if (!$access_check || $this->account->hasPermission('link to any page')) {
    $router = $this->accessUnawareRouter;
  }
  else {
    $router = $this->accessAwareRouter;
  }

  $path = $this->pathProcessor->processInbound('/' . $path, $request);

  try {
    return $router->match($path);
  }
  catch (ResourceNotFoundException $e) {
    return FALSE;
  }
  catch (ParamNotConvertedException $e) {
    return FALSE;
  }
  catch (AccessDeniedHttpException $e) {
    return FALSE;
  }
  catch (MethodNotAllowedException $e) {
    return FALSE;
  }
}
doc_Drupal
2016-10-29 09:33:35
Comments
Leave a Comment

Please login to continue.