diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index 2ece2b5..2829589 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -773,6 +773,9 @@ public function removeTranslation($langcode) { } } $this->translations[$langcode]['status'] = static::TRANSLATION_REMOVED; + if ($this->activeLangcode == $langcode) { + $this->activeLangcode = LanguageInterface::LANGCODE_DEFAULT; + } } else { $message = 'The specified translation (@langcode) cannot be removed.'; diff --git a/core/lib/Drupal/Core/ParamConverter/EntityConverter.php b/core/lib/Drupal/Core/ParamConverter/EntityConverter.php index 04665e6..e371509 100644 --- a/core/lib/Drupal/Core/ParamConverter/EntityConverter.php +++ b/core/lib/Drupal/Core/ParamConverter/EntityConverter.php @@ -8,6 +8,7 @@ namespace Drupal\Core\ParamConverter; use Drupal\Core\Entity\EntityManagerInterface; +use Drupal\Core\Entity\EntityInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Route; @@ -26,7 +27,7 @@ class EntityConverter implements ParamConverterInterface { /** * Constructs a new EntityConverter. * - * @param \Drupal\Core\Entity\EntityManagerInterface $entityManager + * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager. */ public function __construct(EntityManagerInterface $entity_manager) { @@ -39,7 +40,11 @@ public function __construct(EntityManagerInterface $entity_manager) { public function convert($value, $definition, $name, array $defaults, Request $request) { $entity_type = substr($definition['type'], strlen('entity:')); if ($storage = $this->entityManager->getStorage($entity_type)) { - return $storage->load($value); + $entity = $storage->load($value); + if ($entity instanceof EntityInterface) { + $entity = $this->entityManager->getTranslationFromContext($entity); + } + return $entity; } }