You are here

public function SearchPluginBase::buildResults in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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

1 method overrides SearchPluginBase::buildResults()
SearchExtraTypeSearch::buildResults in core/modules/search/tests/modules/search_extra_type/src/Plugin/Search/SearchExtraTypeSearch.php
Executes the search and builds render arrays for the result items.

File

core/modules/search/src/Plugin/SearchPluginBase.php, line 102
Contains \Drupal\search\Plugin\SearchPluginBase.

Class

SearchPluginBase
Defines a base class for plugins wishing to support search.

Namespace

Drupal\search\Plugin

Code

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