You are here

public function PubSubHubbub::onDeleteMultipleFeeds in Feeds 8.3

Deletes subscriptions when feeds are deleted.

Parameters

\Drupal\feeds\Event\DeleteFeedsEvent $event: The delete event.

File

src/EventSubscriber/PubSubHubbub.php, line 302

Class

PubSubHubbub
Event listener for PubSubHubbub subscriptions.

Namespace

Drupal\feeds\EventSubscriber

Code

public function onDeleteMultipleFeeds(DeleteFeedsEvent $event) {
  $subscriptions = $this->storage
    ->loadMultiple(array_keys($event
    ->getFeeds()));
  foreach ($event
    ->getFeeds() as $feed) {
    if (!isset($subscriptions[$feed
      ->id()])) {
      continue;
    }
    $this
      ->unsubscribe($feed, $subscriptions[$feed
      ->id()]);
  }
}