diff --git a/core/modules/content_translation/src/Form/ContentTranslationDeleteForm.php b/core/modules/content_translation/src/Form/ContentTranslationDeleteForm.php index 49efba9..a17479a 100644 --- a/core/modules/content_translation/src/Form/ContentTranslationDeleteForm.php +++ b/core/modules/content_translation/src/Form/ContentTranslationDeleteForm.php @@ -77,14 +77,6 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $this->entity->removeTranslation($this->language->getId()); $this->entity->save(); - // Remove any existing path alias for the removed translation. - // @todo This should be taken care of by the Path module. - if (\Drupal::moduleHandler()->moduleExists('path')) { - $path = $this->entity->urlInfo()->getInternalPath(); - $conditions = array('source' => $path, 'langcode' => $this->language->getId()); - \Drupal::service('path.alias_storage')->delete($conditions); - } - $form_state->setRedirectUrl($this->getCancelUrl()); } diff --git a/core/modules/path/path.module b/core/modules/path/path.module index 85fe106..707481f 100644 --- a/core/modules/path/path.module +++ b/core/modules/path/path.module @@ -5,6 +5,7 @@ * Enables users to rename URLs. */ +use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\FieldDefinition; use Drupal\Core\Field\BaseFieldDefinition; @@ -77,3 +78,12 @@ function path_entity_base_field_info(EntityTypeInterface $entity_type) { return $fields; } } + +/** + * Implements hook_entity_translation_delete() + */ +function path_entity_translation_delete(EntityInterface $translation) { + $path = $translation->urlInfo()->getInternalPath(); + $conditions = array('source' => $path, 'langcode' => $translation->language()->getId()); + \Drupal::service('path.alias_storage')->delete($conditions); +}