function hook_search_api_page_alter in Search API Pages 8
Alter the Search API results page.
Modules may implement this hook to alter the search results page elements, all properties from \Drupal\search_api\Query\ResultSet are available here.
Parameters
array $build: An array containing all page elements.
\Drupal\search_api\Query\ResultSet $query_result: Search API query result.
\Drupal\search_api_page\SearchApiPageInterface $search_api_page: The Search API Page entity object.
See also
\Drupal\search_api_page\Controller\SearchApiPageController
1 invocation of hook_search_api_page_alter()
- SearchApiPageController::finishBuild in src/
Controller/ SearchApiPageController.php - Finishes the build.
File
- ./
search_api_page.api.php, line 23 - Hooks provided by the Search API Page module.
Code
function hook_search_api_page_alter(&$build, $query_result, $search_api_page) {
$search_title = \Drupal::translation()
->translate('There are @count Search results at @path.', [
'@count' => $query_result
->getResultCount(),
'@path' => $search_api_page
->getPath(),
]);
$build['#search_title'] = [
'#markup' => $search_title,
];
}