You are here

public static function Feed::postDelete in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/aggregator/src/Entity/Feed.php \Drupal\aggregator\Entity\Feed::postDelete()

Acts on deleted entities before the delete hook is invoked.

Used after the entities are deleted but before invoking the delete hook.

Parameters

\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.

\Drupal\Core\Entity\EntityInterface[] $entities: An array of entities.

Overrides Entity::postDelete

File

core/modules/aggregator/src/Entity/Feed.php, line 116
Contains \Drupal\aggregator\Entity\Feed.

Class

Feed
Defines the aggregator feed entity class.

Namespace

Drupal\aggregator\Entity

Code

public static function postDelete(EntityStorageInterface $storage, array $entities) {
  parent::postDelete($storage, $entities);
  if (\Drupal::moduleHandler()
    ->moduleExists('block')) {

    // Make sure there are no active blocks for these feeds.
    $ids = \Drupal::entityQuery('block')
      ->condition('plugin', 'aggregator_feed_block')
      ->condition('settings.feed', array_keys($entities))
      ->execute();
    if ($ids) {
      $block_storage = \Drupal::entityManager()
        ->getStorage('block');
      $block_storage
        ->delete($block_storage
        ->loadMultiple($ids));
    }
  }
}