public function WorkspaceListBuilder::load in Drupal 10
Same name and namespace in other branches
- 8 core/modules/workspaces/src/WorkspaceListBuilder.php \Drupal\workspaces\WorkspaceListBuilder::load()
- 9 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 82
Class
- WorkspaceListBuilder
- Defines a class to build a listing of workspace entities.
Namespace
Drupal\workspacesCode
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;
}