class EntityQueueRepository in Entityqueue 8
Class EntityQueueRepository.
Hierarchy
- class \Drupal\entityqueue\EntityQueueRepository implements EntityQueueRepositoryInterface
Expanded class hierarchy of EntityQueueRepository
1 string reference to 'EntityQueueRepository'
1 service uses EntityQueueRepository
File
- src/
EntityQueueRepository.php, line 11
Namespace
Drupal\entityqueueView source
class EntityQueueRepository implements EntityQueueRepositoryInterface {
/**
* Drupal\Core\Entity\EntityTypeManagerInterface definition.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a new EntityQueueRepository object.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
public function getAvailableQueuesForEntity(EntityInterface $entity) {
$storage = $this->entityTypeManager
->getStorage('entity_queue');
$queue_ids = $storage
->getQuery()
->condition('entity_settings.target_type', $entity
->getEntityTypeId(), '=')
->condition('status', TRUE)
->execute();
$queues = $storage
->loadMultiple($queue_ids);
$queues = array_filter($queues, function ($queue) use ($entity) {
/** @var \Drupal\entityqueue\EntityQueueInterface $queue */
$queue_settings = $queue
->getEntitySettings();
$target_bundles =& $queue_settings['handler_settings']['target_bundles'];
return $target_bundles === NULL || in_array($entity
->bundle(), $target_bundles, TRUE);
});
return $queues;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityQueueRepository:: |
protected | property | Drupal\Core\Entity\EntityTypeManagerInterface definition. | |
EntityQueueRepository:: |
public | function |
Gets a list of queues which can hold this entity. Overrides EntityQueueRepositoryInterface:: |
|
EntityQueueRepository:: |
public | function | Constructs a new EntityQueueRepository object. |