You are here

public function SearchPage::displaySearchResults in Simple Google Custom Search Engine 8

Same name and namespace in other branches
  1. 2.0.x src/Controller/SearchPage.php \Drupal\simple_gse_search\Controller\SearchPage::displaySearchResults()

Function responsible for returning the search results page.

1 string reference to 'SearchPage::displaySearchResults'
simple_gse_search.routing.yml in ./simple_gse_search.routing.yml
simple_gse_search.routing.yml

File

src/Controller/SearchPage.php, line 43

Class

SearchPage
Defines a controller for displaying search results from Google CSE.

Namespace

Drupal\simple_gse_search\Controller

Code

public function displaySearchResults() {

  // Display the results returned by Google.
  return [
    '#type' => 'html_tag',
    '#tag' => 'gcse:searchresults-only',
    '#attributes' => [
      'queryParameterName' => "s",
      'linktarget' => '_parent',
    ],
    '#value' => 'Please make sure javascript is enabled to see the search results.',
    '#attached' => [
      'library' => [
        'simple_gse_search/search',
      ],
      'drupalSettings' => [
        'simple_gse_search' => [
          'cx' => $this->searchConfig
            ->get('cx'),
        ],
      ],
    ],
  ];
}