Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityOperations.php

function EntityOperations::entityTranslationDelete

Parameters

\Drupal\Core\Entity\EntityInterface $translation: The entity translation being deleted.

See also

hook_entity_translation_delete()

File

core/modules/content_moderation/src/EntityOperations.php, line 256

Class

EntityOperations
Defines a class for reacting to entity events.

Namespace

Drupal\content_moderation

Code

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);
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal