Feed::postDelete

public static Feed::postDelete(EntityStorageInterface $storage, array $entities)

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 111

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));
    }
  }
}
doc_Drupal
2016-10-29 09:09:56
Comments
Leave a Comment

Please login to continue.