You are here

public function UserListBuilder::load in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/user/src/UserListBuilder.php \Drupal\user\UserListBuilder::load()
  2. 9 core/modules/user/src/UserListBuilder.php \Drupal\user\UserListBuilder::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/user/src/UserListBuilder.php, line 68

Class

UserListBuilder
Defines a class to build a listing of user entities.

Namespace

Drupal\user

Code

public function load() {
  $entity_query = $this->storage
    ->getQuery();
  $entity_query
    ->accessCheck(TRUE);
  $entity_query
    ->condition('uid', 0, '<>');
  $entity_query
    ->pager(50);
  $header = $this
    ->buildHeader();
  $entity_query
    ->tableSort($header);
  $uids = $entity_query
    ->execute();
  return $this->storage
    ->loadMultiple($uids);
}