You are here

protected function PathProcessor::getPath in Sub-pathauto (Sub-path URL Aliases) 8

Helper function to handle multilingual paths.

Parameters

string $path_info: Path that might contain language prefix.

Return value

string Path without language prefix.

1 call to PathProcessor::getPath()
PathProcessor::processInbound in src/PathProcessor.php
Processes the inbound path.

File

src/PathProcessor.php, line 150

Class

PathProcessor
Processes the inbound path using path alias lookups.

Namespace

Drupal\subpathauto

Code

protected function getPath($path_info) {
  $language_prefix = '/' . $this->languageManager
    ->getCurrentLanguage(LanguageInterface::TYPE_URL)
    ->getId() . '/';
  if (substr($path_info, 0, strlen($language_prefix)) == $language_prefix) {
    $path_info = '/' . substr($path_info, strlen($language_prefix));
  }
  return $path_info;
}