Skip to content
Snippets Groups Projects

Resolve #3078075 "Detect and strip"

Open Dieter Holvoet requested to merge issue/linkit-3078075:3078075-detect-and-strip into 7.x
1 unresolved thread
1 file
+ 0
23
Compare changes
  • Side-by-side
  • Inline
@@ -573,29 +573,6 @@ class EntityMatcher extends ConfigurableMatcherBase {
$host = parse_url($user_input, PHP_URL_HOST);
$host_end = strpos($user_input, $host) + strlen($host);
$user_input = substr($user_input, $host_end);
if ($this->moduleHandler->moduleExists('language')) {
$config = $this->configFactory->get('language.negotiation')->get('url');
if ($config['source'] === LanguageNegotiationUrl::CONFIG_PATH_PREFIX) {
$language_manager = \Drupal::service('language_manager');
/** @var \Drupal\Core\Language\Language[] $languages */
$languages = $language_manager->getLanguages();
// Remove the leading slash for easier manipulation of the remaining
// args.
$path = urldecode(trim($user_input, '/'));
$path_args = explode('/', $path);
$prefix = array_shift($path_args);
// Search prefix within added languages.
foreach ($languages as $language) {
if (isset($config['prefixes'][$language->getId()]) && $config['prefixes'][$language->getId()] == $prefix) {
$user_input = '/' . implode('/', $path_args);
$user_input = $this->aliasManager->getPathByAlias($user_input, $language->getId());
break;
}
}
}
}
}
}
Loading