Commit 852caf50 authored by Oleh Shevchuk's avatar Oleh Shevchuk
Browse files

Remove the /edit part from the entity internal path.

parent 547fdffc
......@@ -125,6 +125,7 @@ class LinkitFilter extends FilterBase implements ContainerFactoryPluginInterface
// Extract the langcode from each URL, if available.
// Fallback to the langcode applicable to the whole element.
$entityInternalPath = $entity->toUrl('canonical')->getInternalPath();
$entityInternalPath = preg_replace('/\/edit$/', '', $entityInternalPath);
$langcodeFromUrl = trim(str_replace($entityInternalPath, '', $href_url["path"]), '/');
$langcode = $this->languageManager->getLanguage($langcode) ? $langcodeFromUrl : $langcode;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment