function Feed::postDelete

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

Overrides EntityBase::postDelete

File

core/modules/aggregator/src/Entity/Feed.php, line 119

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')->accessCheck(FALSE)
            ->condition('plugin', 'aggregator_feed_block')
            ->condition('settings.feed', array_keys($entities))
            ->execute();
        if ($ids) {
            $block_storage = \Drupal::entityTypeManager()->getStorage('block');
            $block_storage->delete($block_storage->loadMultiple($ids));
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.