You are here

protected function EntityQueueListBuilder::getQueueItemsStatus in Entityqueue 8

Returns the number of items in a subqueue or the number of subqueues.

Parameters

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

Return value

string The number of items in a subqueue or the number of subqueues.

1 call to EntityQueueListBuilder::getQueueItemsStatus()
EntityQueueListBuilder::buildRow in src/EntityQueueListBuilder.php
Builds a row for an entity in the entity listing.

File

src/EntityQueueListBuilder.php, line 187

Class

EntityQueueListBuilder
Defines a class that builds a listing of entity queues.

Namespace

Drupal\entityqueue

Code

protected function getQueueItemsStatus(EntityQueueInterface $queue) {
  $handler = $queue
    ->getHandlerPlugin();
  $items = NULL;
  if ($handler
    ->supportsMultipleSubqueues()) {
    $subqueues_count = $this->entityTypeManager
      ->getStorage('entity_subqueue')
      ->getQuery()
      ->condition('queue', $queue
      ->id(), '=')
      ->count()
      ->execute();
    $items = $this
      ->formatPlural($subqueues_count, '@count subqueue', '@count subqueues');
  }
  else {
    $subqueue = EntitySubqueue::load($queue
      ->id());
    $items = $this
      ->formatPlural(count($subqueue->items), '@count item', '@count items');
  }
  return $items;
}