You are here

public function AbstractSolrEntityListBuilder::getAllRecommendedEntities in Search API Solr 8.3

Same name and namespace in other branches
  1. 4.x src/Controller/AbstractSolrEntityListBuilder.php \Drupal\search_api_solr\Controller\AbstractSolrEntityListBuilder::getAllRecommendedEntities()

Get all recommended entities.

Return value

array An array of all recommended entities.

File

src/Controller/AbstractSolrEntityListBuilder.php, line 345

Class

AbstractSolrEntityListBuilder
Provides a listing of Solr Entities.

Namespace

Drupal\search_api_solr\Controller

Code

public function getAllRecommendedEntities() : array {

  // Bypass AbstractSolrEntityListBuilder::load() by calling the parent. But
  // don't use parent::load() in case someone copies this function in an
  // inherited class.
  $entities = ConfigEntityListBuilder::load();
  foreach ($entities as $key => $entity) {
    if (!$entity
      ->isRecommended()) {
      unset($entities[$key]);
    }
  }
  return $entities;
}