You are here

public function GoogleCSESearch::buildResults in Google Custom Search Engine 8.3

Same name and namespace in other branches
  1. 8.2 src/Plugin/Search/GoogleCSESearch.php \Drupal\google_cse\Plugin\Search\GoogleCSESearch::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 SearchPluginBase::buildResults

File

src/Plugin/Search/GoogleCSESearch.php, line 176

Class

GoogleCSESearch
Handles searching for node entities using the Search module index.

Namespace

Drupal\google_cse\Plugin\Search

Code

public function buildResults() {

  // Results are primarily generated by the Google API.
  $output[] = [
    '#theme' => 'google_cse_results',
    '#attached' => [
      'drupalSettings' => [
        'googleCSE' => [
          'cx' => $this->configuration['cx'],
        ],
      ],
    ],
  ];
  return $output;
}