diff --git c/core/lib/Drupal/Core/Entity/ContentEntityDeleteForm.php w/core/lib/Drupal/Core/Entity/ContentEntityDeleteForm.php index f07ad3f..fa7a9d9 100644 --- c/core/lib/Drupal/Core/Entity/ContentEntityDeleteForm.php +++ w/core/lib/Drupal/Core/Entity/ContentEntityDeleteForm.php @@ -32,7 +32,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { drupal_set_message(t('The @language translation has been removed.', array( '@language' => $language_name, ))); - $form_state->setRedirectUrl($entity->urlInfo('canonical')); + $form_state->setRedirectUrl($entity_untranslated->urlInfo('canonical')); $this->logger('content')->notice('@type: @language translation deleted %title.', ['@type' => $entity->getType(), '%title' => $entity->label(), '@language' => $language_name]); } else { diff --git c/core/lib/Drupal/Core/Entity/Entity.php w/core/lib/Drupal/Core/Entity/Entity.php index a5c3d0f..a11ed15 100644 --- c/core/lib/Drupal/Core/Entity/Entity.php +++ w/core/lib/Drupal/Core/Entity/Entity.php @@ -124,6 +124,19 @@ public function enforceIsNew($value = TRUE) { } /** + * Checks if entity is a translation. + * + * @return boolean + * true if it is a translation. + */ + public function isTranslation() { + if ($this->language()->getId() != $this->getUntranslated()->language()->getId()) { + return true; + } + return false; + } + + /** * {@inheritdoc} */ public function getEntityTypeId() { diff --git c/core/modules/content_translation/src/ContentTranslationHandler.php w/core/modules/content_translation/src/ContentTranslationHandler.php index 8b6862e..dd24f3c 100644 --- c/core/modules/content_translation/src/ContentTranslationHandler.php +++ w/core/modules/content_translation/src/ContentTranslationHandler.php @@ -231,7 +231,7 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En $this->entityFormDelete($form, $form_state); return; } - elseif (!($form_state->getFormObject()->getOperation() == 'edit' or $form_state->getFormObject()->getOperation() == 'default')) { + elseif (!($form_state->getFormObject()->getOperation() == 'edit' || $form_state->getFormObject()->getOperation() == 'default')) { return; } @@ -603,16 +603,15 @@ public function entityFormSourceChange($form, FormStateInterface $form_state) { * * Takes care of entity deletion. */ - function entityFormDelete(&$form, FormStateInterface $form_state) { + protected function entityFormDelete(&$form, FormStateInterface $form_state) { $entity = $form_state->getFormObject()->getEntity(); - $is_translation = $entity->language()->getId() != $entity->getUntranslated()->language()->getId(); $languages = []; foreach ($entity->getTranslationLanguages() as $language) { array_push($languages, t('@language', array('@language' => $language->getName()))); } - if (count($entity->getTranslationLanguages()) > 1 && !$is_translation) { + if (count($entity->getTranslationLanguages()) > 1 && !$entity->isTranslation()) { - $form['text']['#markup'] = '

' . t('This will delete the translations:') . '

'; + $form['text']['#markup'] = '

' . t('This will delete the following translations:') . '

'; $form['languages'] = array( '#theme' => 'item_list', '#items' => $languages, diff --git c/core/modules/node/src/NodeTranslationHandler.php w/core/modules/node/src/NodeTranslationHandler.php index 97b29d2..2f5ad6c 100644 --- c/core/modules/node/src/NodeTranslationHandler.php +++ w/core/modules/node/src/NodeTranslationHandler.php @@ -65,7 +65,7 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En // Change the submit button label for delete forms. if ($is_delete_form) { - if ($is_translation = $entity->language()->getId() != $entity->getUntranslated()->language()->getId()) { + if ($entity->isTranslation()) { $form['actions']['submit']['#value'] = t('Delete @language translation', array('@language' => $entity->language()->getName())); } } diff --git c/core/modules/system/src/Tests/Entity/EntityFormTest.php w/core/modules/system/src/Tests/Entity/EntityFormTest.php index 9529f3f..d5f21de 100644 --- c/core/modules/system/src/Tests/Entity/EntityFormTest.php +++ w/core/modules/system/src/Tests/Entity/EntityFormTest.php @@ -46,7 +46,7 @@ function testFormCRUD() { /** * Tests basic multilingual form CRUD functionality. */ - function testMultilingualFormCRUD() { + public function testMultilingualFormCRUD() { // All entity variations have to have the same results. foreach (entity_test_entity_types(ENTITY_TEST_TYPES_MULTILINGUAL) as $entity_type) { $this->doTestMultilingualFormCRUD($entity_type); @@ -144,8 +144,9 @@ protected function doTestMultilingualFormCRUD($entity_type_id) { protected function loadEntityByName($entity_type, $name) { // Always load the entity from the database to ensure that changes are // correctly picked up. - $this->container->get('entity.manager')->getStorage($entity_type)->resetCache(); - $entities = entity_load_multiple_by_properties($entity_type, array('name' => $name)); + $entity_storage = $this->container->get('entity.manager')->getStorage($entity_type); + $entity_storage->resetCache(); + $entities = $entity_storage->loadByProperties($entity_type, array('name' => $name)); return $entities ? current($entities) : NULL; } }