You are here

public function Multiple::onQueuePostDelete in Entityqueue 8

Acts on deleted entity queues before the delete hook is invoked.

Parameters

\Drupal\entityqueue\EntityQueueInterface $queue: The entity queue object.

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

Overrides EntityQueueHandlerBase::onQueuePostDelete

1 method overrides Multiple::onQueuePostDelete()
SmartQueue::onQueuePostDelete in modules/entityqueue_smartqueue/src/Plugin/EntityQueueHandler/SmartQueue.php
Acts on deleted entity queues before the delete hook is invoked.

File

src/Plugin/EntityQueueHandler/Multiple.php, line 77

Class

Multiple
Defines an entity queue handler that manages multiple subqueues.

Namespace

Drupal\entityqueue\Plugin\EntityQueueHandler

Code

public function onQueuePostDelete(EntityQueueInterface $queue, EntityStorageInterface $storage) {

  // Delete all the subqueues when the parent queue is deleted.
  $subqueue_storage = $this->entityTypeManager
    ->getStorage('entity_subqueue');
  $subqueues = $subqueue_storage
    ->loadByProperties([
    $this->entityTypeManager
      ->getDefinition('entity_subqueue')
      ->getKey('bundle') => $queue
      ->id(),
  ]);
  $subqueue_storage
    ->delete($subqueues);
}