Verified Commit 46853e85 authored by Dave Long's avatar Dave Long
Browse files

Issue #3332872 by Akram Khan, PrabuEla, smustgrave, longwave, joachim: Allow...

Issue #3332872 by Akram Khan, PrabuEla, smustgrave, longwave, joachim: Allow EntityListBuilder::getEntityIds() to easily extend the query
parent d67466cf
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
use Drupal\Core\Routing\RedirectDestinationTrait;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Entity\Query\QueryInterface;

/**
 * Defines a generic implementation to build a listing of entities.
@@ -94,6 +95,16 @@ public function load() {
   *   An array of entity IDs.
   */
  protected function getEntityIds() {
    return $this->getQuery()->execute();
  }

  /**
   * Returns a query object for loading entity IDs from the storage.
   *
   * @return \Drupal\Core\Entity\Query\QueryInterface
   *   A query object used to load entity IDs.
   */
  protected function getQuery(): QueryInterface {
    $query = $this->getStorage()->getQuery()
      ->accessCheck(TRUE)
      ->sort($this->entityType->getKey('id'));
@@ -102,7 +113,7 @@ protected function getEntityIds() {
    if ($this->limit) {
      $query->pager($this->limit);
    }
    return $query->execute();
    return $query;
  }

  /**