You are here

public function ConfigEntityRevisionsControllerBase::deleteRevisions in Config Entity Revisions 8

Same name and namespace in other branches
  1. 1.x src/ConfigEntityRevisionsControllerBase.php \Drupal\config_entity_revisions\ConfigEntityRevisionsControllerBase::deleteRevisions()

Delete revisions when a config entity is deleted.

Parameters

ConfigEntityRevisionsInterface $config_entity: The configuration entity being deleted.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

\Drupal\Core\Entity\EntityStorageException

Overrides ConfigEntityRevisionsControllerInterface::deleteRevisions

File

src/ConfigEntityRevisionsControllerBase.php, line 398

Class

ConfigEntityRevisionsControllerBase
Controller to make library functions available to various consumers.

Namespace

Drupal\config_entity_revisions

Code

public function deleteRevisions(ConfigEntityRevisionsInterface $config_entity) {
  $contentEntity = $config_entity
    ->getContentEntity();
  if ($contentEntity) {
    $config_entity
      ->contentEntityStorage()
      ->delete([
      $contentEntity,
    ]);
  }
}