You are here

public function EntityConfigBase::rollback in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/src/Plugin/migrate/destination/EntityConfigBase.php \Drupal\migrate\Plugin\migrate\destination\EntityConfigBase::rollback()
  2. 9 core/modules/migrate/src/Plugin/migrate/destination/EntityConfigBase.php \Drupal\migrate\Plugin\migrate\destination\EntityConfigBase::rollback()

Delete the specified destination object from the target Drupal.

Parameters

array $destination_identifier: The ID of the destination object to delete.

Overrides Entity::rollback

2 calls to EntityConfigBase::rollback()
EntityFieldStorageConfig::rollback in core/modules/migrate/src/Plugin/migrate/destination/EntityFieldStorageConfig.php
Delete the specified destination object from the target Drupal.
EntityViewMode::rollback in core/modules/migrate/src/Plugin/migrate/destination/EntityViewMode.php
Delete the specified destination object from the target Drupal.
2 methods override EntityConfigBase::rollback()
EntityFieldStorageConfig::rollback in core/modules/migrate/src/Plugin/migrate/destination/EntityFieldStorageConfig.php
Delete the specified destination object from the target Drupal.
EntityViewMode::rollback in core/modules/migrate/src/Plugin/migrate/destination/EntityViewMode.php
Delete the specified destination object from the target Drupal.

File

core/modules/migrate/src/Plugin/migrate/destination/EntityConfigBase.php, line 278

Class

EntityConfigBase
Base destination class for importing configuration entities.

Namespace

Drupal\migrate\Plugin\migrate\destination

Code

public function rollback(array $destination_identifier) {
  if ($this
    ->isTranslationDestination()) {

    // The entity id does not include the langcode.
    $id_values = [];
    foreach ($destination_identifier as $key => $value) {
      if ($this
        ->isTranslationDestination() && $key === 'langcode') {
        continue;
      }
      $id_values[] = $value;
    }
    $entity_id = implode('.', $id_values);
    $language = $destination_identifier['langcode'];
    $config = $this->storage
      ->load($entity_id)
      ->getConfigDependencyName();
    $config_override = $this->languageManager
      ->getLanguageConfigOverride($language, $config);

    // Rollback the translation.
    $config_override
      ->delete();
  }
  else {
    $destination_identifier = implode('.', $destination_identifier);
    parent::rollback([
      $destination_identifier,
    ]);
  }
}