CurrentPathStack::getPath

public CurrentPathStack::getPath($request = NULL)

Returns the path of the current request.

Parameters

\Symfony\Component\HttpFoundation\Request $request: (optional) The request.

Return value

string Returns the path, without leading slashes.

File

core/lib/Drupal/Core/Path/CurrentPathStack.php, line 49

Class

CurrentPathStack
Represents the current path for the current request.

Namespace

Drupal\Core\Path

Code

1
2
3
4
5
6
7
8
9
10
public function getPath($request = NULL) {
  if (!isset($request)) {
    $request = $this->requestStack->getCurrentRequest();
  }
  if (!isset($this->paths[$request])) {
    $this->paths[$request] = $request->getPathInfo();
  }
 
  return $this->paths[$request];
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.