Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CurrentPathStack.php

function 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 72

Class

CurrentPathStack
Represents the current path for the current request.

Namespace

Drupal\Core\Path

Code

public function setPath($path, ?Request $request = NULL) {
    if (!isset($request)) {
        $request = $this->requestStack
            ->getCurrentRequest();
    }
    $this->paths[$request] = $path;
    return $this;
}
RSS feed
Powered by Drupal