You are here

public function PathPrefixMethod::alterRequest in Persistent URL 8

Overrides RequestAlteringInterface::alterRequest

File

src/Plugin/Purl/Method/PathPrefixMethod.php, line 27

Class

PathPrefixMethod
Plugin annotation @PurlMethod( id="path_prefix" )

Namespace

Drupal\purl\Plugin\Purl\Method

Code

public function alterRequest(Request $request, $identifier) {
  $uri = $request
    ->getRequestUri();
  $newPath = substr($uri, strlen($identifier) + 1);
  $request->server
    ->set('REQUEST_URI', $newPath);
}