You are here

function hook_gss_search_result in Google Site Search 8

Act on a GSS search result being displayed.

This hook is invoked from the gss search plugin during search execution, after retrieving the search results.

Parameters

stdClass $result: The search result item from Google Site Search API.

Return value

array Extra information to be displayed with search result. This information should be presented as an associative array. It will be concatenated with the post information (last updated, author) in the default search result theming.

See also

template_preprocess_search_result()

search-result.html.twig

1 function implements hook_gss_search_result()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

gss_gss_search_result in ./gss.module
Implements hook_gss_search_result().
1 invocation of hook_gss_search_result()
Search::prepareResults in src/Plugin/Search/Search.php
Prepares search results for rendering.

File

./gss.api.php, line 31
Hooks specific to the Google Site Search module.

Code

function hook_gss_search_result($result) {
  if (isset($result->pagemap->cse_thumbnail[0])) {
    return [
      'cse_thumbnail' => [
        '#theme' => 'image',
        '#uri' => $result->pagemap->cse_thumbnail[0]->src,
      ],
    ];
  }
}