You are here

public function AbstractSolrEntityListBuilder::getRecommendedEntities in Search API Solr 4.x

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

Get all recommended Entities.

Return value

array An array of all recommended entities.

Throws

\Drupal\search_api\SearchApiException

File

src/Controller/AbstractSolrEntityListBuilder.php, line 311

Class

AbstractSolrEntityListBuilder
Provides a listing of Solr Entities.

Namespace

Drupal\search_api_solr\Controller

Code

public function getRecommendedEntities() : array {
  $entities = $this
    ->load();
  foreach ($entities as $key => $entity) {
    if (!$entity
      ->isRecommended()) {
      unset($entities[$key]);
    }
  }
  return $entities;
}