You are here

private function RenameAdminPathsEventSubscriber::replaceRoutePath in Rename Admin Paths 8.2

Parameters

Route $route:

string $from:

string $to:

1 call to RenameAdminPathsEventSubscriber::replaceRoutePath()
RenameAdminPathsEventSubscriber::alterRouteCollection in src/EventSubscriber/RenameAdminPathsEventSubscriber.php

File

src/EventSubscriber/RenameAdminPathsEventSubscriber.php, line 83

Class

RenameAdminPathsEventSubscriber

Namespace

Drupal\rename_admin_paths\EventSubscriber

Code

private function replaceRoutePath(Route $route, string $from, string $to) : void {
  if ($this
    ->matchRouteByPath($route, $from)) {
    $route
      ->setPath(preg_replace(sprintf('~^/%s~', $from), sprintf('/%s', $to), $route
      ->getPath(), 1));
  }
}