You are here

public function CurrentPathStack::setPath in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Path/CurrentPathStack.php \Drupal\Core\Path\CurrentPathStack::setPath()

Sets the current path.

Parameters

string $path: The path.

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

Return value

$this

File

core/lib/Drupal/Core/Path/CurrentPathStack.php, line 75
Contains \Drupal\Core\Path\CurrentPathStack.

Class

CurrentPathStack
Represents the current path for the current request.

Namespace

Drupal\Core\Path

Code

public function setPath($path, $request = NULL) {
  if (!isset($request)) {
    $request = $this->requestStack
      ->getCurrentRequest();
  }
  $this->paths[$request] = $path;
  return $this;
}