You are here

public function SmartQueue::getEntityIds in Entityqueue 8

Gets a list of entity IDs for which to create subqueues.

Return value

array An array of entity IDs.

1 call to SmartQueue::getEntityIds()
SmartQueue::onQueuePostSave in modules/entityqueue_smartqueue/src/Plugin/EntityQueueHandler/SmartQueue.php
Acts on an entity queue before the insert or update hook is invoked.

File

modules/entityqueue_smartqueue/src/Plugin/EntityQueueHandler/SmartQueue.php, line 331

Class

SmartQueue
Plugin annotation @EntityQueueHandler( id = "smartqueue", title = @Translation("Smart queue"), description = @Translation("Provides automated subqueues for each entity of a given type."), )

Namespace

Drupal\entityqueue_smartqueue\Plugin\EntityQueueHandler

Code

public function getEntityIds() {
  $entity_type_id = $this->configuration['entity_type'];
  $entity_type = $this->entityTypeManager
    ->getDefinition($entity_type_id);
  $query = $this->entityTypeManager
    ->getStorage($entity_type_id)
    ->getQuery();
  if ($entity_type
    ->hasKey('bundle') && !empty($this->configuration['bundles'])) {
    $query
      ->condition($entity_type
      ->getKey('bundle'), $this->configuration['bundles'], 'IN');
  }
  return $query
    ->execute();
}