protected function SearchApiPageController::addSearchForm in Search API Pages 8
Adds the search form to the build.
Parameters
array $build: The build to add the form to.
\Drupal\search_api_page\SearchApiPageInterface $search_api_page: The search api page.
mixed $keys: The search word.
Return value
array The build with the search form added to it.
1 call to SearchApiPageController::addSearchForm()
- SearchApiPageController::page in src/
Controller/ SearchApiPageController.php - Page callback.
File
- src/
Controller/ SearchApiPageController.php, line 136
Class
- SearchApiPageController
- Defines a controller to serve search pages.
Namespace
Drupal\search_api_page\ControllerCode
protected function addSearchForm(array $build, SearchApiPageInterface $search_api_page, $keys) {
$block_form = \Drupal::getContainer()
->get('block_form.search_api_page');
$block_form
->setPageId($search_api_page
->id());
$args = [
'keys' => $keys,
];
$build['#form'] = $this
->formBuilder()
->getForm($block_form, $args);
return $build;
}