public function SearchPluginBase::buildResults in Drupal 10
Same name and namespace in other branches
- 8 core/modules/search/src/Plugin/SearchPluginBase.php \Drupal\search\Plugin\SearchPluginBase::buildResults()
- 9 core/modules/search/src/Plugin/SearchPluginBase.php \Drupal\search\Plugin\SearchPluginBase::buildResults()
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 SearchInterface::buildResults
File
- core/
modules/ search/ src/ Plugin/ SearchPluginBase.php, line 97
Class
- SearchPluginBase
- Defines a base class for plugins wishing to support search.
Namespace
Drupal\search\PluginCode
public function buildResults() {
$results = $this
->execute();
$built = [];
foreach ($results as $result) {
$built[] = [
'#theme' => 'search_result',
'#result' => $result,
'#plugin_id' => $this
->getPluginId(),
];
}
return $built;
}