You are here

public function Search::buildResults in Google Site Search 8

Executes the search and builds render arrays for the result items.

Return value

array An array of render arrays of search result items (generally each item has '#theme' set to 'search_result'), or an empty array if there are no results.

Overrides SearchPluginBase::buildResults

File

src/Plugin/Search/Search.php, line 612

Class

Search
Handles search using Google Search Engine.

Namespace

Drupal\gss\Plugin\Search

Code

public function buildResults() {
  $results = $this
    ->execute();
  $built = [];
  foreach ($results as $result) {
    $built[] = [
      '#theme' => "search_result__{$this->getPluginId()}",
      '#result' => $result,
      '#plugin_id' => $this
        ->getPluginId(),
    ];
  }
  return $built;
}