Implements Drupal\Core\PathProcessor\InboundPathProcessorInterface::processInbound().
Overrides InboundPathProcessorInterface::processInbound
public function processInbound($path, Request $request) {
if (!empty($path)) {
$args = explode('/', $path);
$prefix = array_shift($args);
// Search prefix within enabled languages.
$prefixes = $this->config
->get('language.negotiation')
->get('url.prefixes');
foreach ($this->languages as $language) {
if (isset($prefixes[$language->langcode]) && $prefixes[$language->langcode] == $prefix) {
// Rebuild $path with the language removed.
return implode('/', $args);
}
}
}
return $path;
}