diff --git a/linkit.module b/linkit.module index e0d6892..b076bf3 100644 --- a/linkit.module +++ b/linkit.module @@ -133,9 +133,10 @@ function linkit_form_editor_link_dialog_submit(array &$form, FormStateInterface if ($entity_type_id && $entity_uuid) { /** @var \Drupal\Core\Entity\EntityInterface $entity */ $entity = \Drupal::service('entity.repository')->loadEntityByUuid($entity_type_id, $entity_uuid); - if ($entity && strpos($href, $entity->label()) !== FALSE) { + $translation = \Drupal::service('entity.repository')->getTranslationFromContext($entity); + if ($entity && strpos($href, $translation->label()) !== FALSE) { $reset_attributes = FALSE; - $form_state->setValue(['attributes', 'href'], $entity->toUrl()->toString()); + $form_state->setValue(['attributes', 'href'], $translation->toUrl()->toString()); } }