|
|
|
|
@ -72,11 +72,17 @@ class UrlExtractor {
|
|
|
|
|
elseif ($input instanceof EntityReferenceItem) { |
|
|
|
|
$entity = $input->entity; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Get the current Language Code. |
|
|
|
|
$languageManager = \Drupal::languageManager(); |
|
|
|
|
$currentLanguage = $languageManager->getCurrentLanguage(LanguageInterface::TYPE_CONTENT); |
|
|
|
|
$languageCode = $currentLanguage->getId(); |
|
|
|
|
|
|
|
|
|
// Drupal does not clean up references to deleted entities. So that the |
|
|
|
|
// entity property might be empty while the field item might not. |
|
|
|
|
// @see https://www.drupal.org/project/drupal/issues/2723323 |
|
|
|
|
return $entity instanceof ContentEntityInterface ? |
|
|
|
|
$this->getUrlFromEntity($entity, $relative) : NULL; |
|
|
|
|
$this->getUrlFromEntity($entity->hasTranslation($langcode) ? $entity->getTranslation($langcode) : $entity , $relative) : NULL; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|