public function EntityOperations::entityTranslationDelete in Config Entity Revisions 8.2
Respond to deletion of an entity translation.
Parameters
\Drupal\Core\Entity\EntityInterface $translation: The entity translation being deleted.
See also
hook_entity_translation_delete()
File
- src/
EntityOperations.php, line 276
Class
- EntityOperations
- Defines a class for reacting to entity events.
Namespace
Drupal\config_entity_revisionsCode
public function entityTranslationDelete(EntityInterface $translation) {
/** @var \Drupal\Core\Entity\ContentEntityInterface $translation */
if (!$translation
->isDefaultTranslation()) {
$langcode = $translation
->language()
->getId();
$content_moderation_state = ContentModerationStateEntity::loadFromModeratedEntity($translation);
if ($content_moderation_state && $content_moderation_state
->hasTranslation($langcode)) {
$content_moderation_state
->removeTranslation($langcode);
ContentModerationStateEntity::updateOrCreateFromEntity($content_moderation_state);
}
}
}