Multiple.php in Entityqueue 8
File
src/Plugin/EntityQueueHandler/Multiple.php
View source
<?php
namespace Drupal\entityqueue\Plugin\EntityQueueHandler;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\entityqueue\EntityQueueHandlerBase;
use Drupal\entityqueue\EntityQueueInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class Multiple extends EntityQueueHandlerBase implements ContainerFactoryPluginInterface {
protected $entityTypeManager;
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityTypeManager = $entity_type_manager;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('entity_type.manager'));
}
public function supportsMultipleSubqueues() {
return TRUE;
}
public function hasAutomatedSubqueues() {
return FALSE;
}
public function onQueuePostDelete(EntityQueueInterface $queue, EntityStorageInterface $storage) {
$subqueue_storage = $this->entityTypeManager
->getStorage('entity_subqueue');
$subqueues = $subqueue_storage
->loadByProperties([
$this->entityTypeManager
->getDefinition('entity_subqueue')
->getKey('bundle') => $queue
->id(),
]);
$subqueue_storage
->delete($subqueues);
}
}
Classes
Name |
Description |
Multiple |
Defines an entity queue handler that manages multiple subqueues. |