function SearchPluginBase::buildResults

Same name in other branches
  1. 9 core/modules/search/src/Plugin/SearchPluginBase.php \Drupal\search\Plugin\SearchPluginBase::buildResults()
  2. 10 core/modules/search/src/Plugin/SearchPluginBase.php \Drupal\search\Plugin\SearchPluginBase::buildResults()
  3. 11.x core/modules/search/src/Plugin/SearchPluginBase.php \Drupal\search\Plugin\SearchPluginBase::buildResults()

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 97

Class

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

Namespace

Drupal\search\Plugin

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.