protected function SearchApiPageController::finishBuildWithResults in Search API Pages 8
Adds the results to the given build and then finishes it.
Parameters
array $build: The build.
\Drupal\search_api\Query\ResultSetInterface $result: Search API result.
array $results: The result item render arrays.
\Drupal\search_api_page\SearchApiPageInterface $search_api_page: The search api page.
Return value
array The finished build.
1 call to SearchApiPageController::finishBuildWithResults()
- SearchApiPageController::page in src/
Controller/ SearchApiPageController.php - Page callback.
File
- src/
Controller/ SearchApiPageController.php, line 308
Class
- SearchApiPageController
- Defines a controller to serve search pages.
Namespace
Drupal\search_api_page\ControllerCode
protected function finishBuildWithResults(array $build, ResultSetInterface $result, array $results, SearchApiPageInterface $search_api_page) {
$build['#search_title'] = [
'#markup' => $this
->t('Search results'),
];
$build['#no_of_results'] = [
'#markup' => $this
->formatPlural($result
->getResultCount(), '1 result found', '@count results found'),
];
$build['#results'] = $results;
$this->pagerManager
->createPager($result
->getResultCount(), $search_api_page
->getLimit());
$build['#pager'] = [
'#type' => 'pager',
];
return $this
->finishBuild($build, $search_api_page, $result);
}