You are here

public static function ConfigPagesType::postDelete in Config Pages 8.3

Same name and namespace in other branches
  1. 8 src/Entity/ConfigPagesType.php \Drupal\config_pages\Entity\ConfigPagesType::postDelete()
  2. 8.2 src/Entity/ConfigPagesType.php \Drupal\config_pages\Entity\ConfigPagesType::postDelete()

Provides the list of config_pages types.

Parameters

\Drupal\Core\Entity\EntityStorageInterface $storage: Storage interface.

array $entities: Array of entities.

Overrides ConfigEntityBundleBase::postDelete

File

src/Entity/ConfigPagesType.php, line 78

Class

ConfigPagesType
Defines the config page type entity.

Namespace

Drupal\config_pages\Entity

Code

public static function postDelete(EntityStorageInterface $storage, array $entities) {
  $query = \Drupal::entityQuery('config_pages');
  $type = array_shift($entities);
  $label = $type
    ->label();
  $config_page_ids = $query
    ->condition('label', $label)
    ->execute();
  $cp_storage = \Drupal::service('entity_type.manager')
    ->getStorage('config_pages');
  $cp_entities = $cp_storage
    ->loadMultiple($config_page_ids);
  $cp_storage
    ->delete($cp_entities);
}