You are here

public function WorkspaceListBuilder::load in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/workspaces/src/WorkspaceListBuilder.php \Drupal\workspaces\WorkspaceListBuilder::load()
  2. 10 core/modules/workspaces/src/WorkspaceListBuilder.php \Drupal\workspaces\WorkspaceListBuilder::load()

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 EntityListBuilder::load

File

core/modules/workspaces/src/WorkspaceListBuilder.php, line 80

Class

WorkspaceListBuilder
Defines a class to build a listing of workspace entities.

Namespace

Drupal\workspaces

Code

public function load() {

  // Get all the workspace entities and sort them in tree order.
  $workspace_tree = $this->workspaceRepository
    ->loadTree();
  $entities = array_replace($workspace_tree, $this->storage
    ->loadMultiple());
  foreach ($entities as $id => $entity) {
    $entity->_depth = $workspace_tree[$id]['depth'];
  }
  return $entities;
}