- 🇫🇷France erwangel
What about this ?
// ------ Added line ( 45 of last dev - media_parent_entity_link_media_view() ) // to get the current language then set the right translated link $language = \Drupal::languageManager()->getCurrentLanguage(); foreach ($components as $componentkey => $component) { if (!empty($component['third_party_settings']['media_parent_entity_link']['link_to_parent'])) { if ($entity->_referringItem) { if ($entity->_referringItem->getParent()) { if ($entity->_referringItem->getParent()->getParent()) { /* @var \Drupal\Core\Entity\EntityInterface $parententity */ if ($parententity = $entity->_referringItem->getParent() ->getParent() ->getValue()) { if (!$parententity->isNew()) { try { // ------ Set the right translated link here ------ //$url = $parententity->toUrl(); $url = $parententity->toUrl('canonical', ['language' => $language]); } catch (Exception $exception) { $url = FALSE; } if ($url) { ...
In some of my tests it gives the right links