protected function Search::prepareResults in Google Site Search 8
Prepares search results for rendering.
Parameters
array $items: Results found from a successful search query execute() method.
Return value
array Array of search result item render arrays (empty array if no results).
1 call to Search::prepareResults()
- Search::execute in src/
Plugin/ Search/ Search.php - Executes the search.
File
- src/
Plugin/ Search/ Search.php, line 588
Class
- Search
- Handles search using Google Search Engine.
Namespace
Drupal\gss\Plugin\SearchCode
protected function prepareResults(array $items) {
$results = [];
foreach ($items as $item) {
$extra = $this->moduleHandler
->invokeAll('gss_search_result', [
$item,
]);
$results[] = [
'link' => $item->link,
'type' => NULL,
'title' => $item->title,
'node' => NULL,
'extra' => $extra,
'score' => NULL,
'snippet' => [
'#markup' => $item->htmlSnippet,
],
'langcode' => $this->languageManager
->getCurrentLanguage()
->getId(),
];
}
return $results;
}