You are here

public function EntityQueueListBuilder::load in Entityqueue 8

Loads entities of this type from storage for listing.

This allows the implementation to manipulate the listing, like filtering or sorting the loaded entities.

Return value

\Drupal\Core\Entity\EntityInterface[] An array of entities implementing \Drupal\Core\Entity\EntityInterface indexed by their IDs. Returns an empty array if no matching entities are found.

Overrides ConfigEntityListBuilder::load

1 call to EntityQueueListBuilder::load()
EntityQueueListBuilder::render in src/EntityQueueListBuilder.php
Builds the entity listing as renderable array for table.html.twig.

File

src/EntityQueueListBuilder.php, line 57

Class

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

Namespace

Drupal\entityqueue

Code

public function load() {
  $entities = [
    'enabled' => [],
    'disabled' => [],
  ];

  /** @var \Drupal\entityqueue\EntityQueueInterface $entity */
  foreach (parent::load() as $entity) {

    // Don't display queues which can not be edited by the user.
    if (!$entity
      ->access('update')) {
      continue;
    }
    if ($entity
      ->status()) {
      $entities['enabled'][] = $entity;
    }
    else {
      $entities['disabled'][] = $entity;
    }
  }
  return $entities;
}