function SearchExtraTypeSearch::execute
Same name in other branches
- 8.9.x core/modules/search/tests/modules/search_extra_type/src/Plugin/Search/SearchExtraTypeSearch.php \Drupal\search_extra_type\Plugin\Search\SearchExtraTypeSearch::execute()
- 10 core/modules/search/tests/modules/search_extra_type/src/Plugin/Search/SearchExtraTypeSearch.php \Drupal\search_extra_type\Plugin\Search\SearchExtraTypeSearch::execute()
- 11.x core/modules/search/tests/modules/search_extra_type/src/Plugin/Search/SearchExtraTypeSearch.php \Drupal\search_extra_type\Plugin\Search\SearchExtraTypeSearch::execute()
Execute the search.
This is a dummy search, so when search "executes", we just return a dummy result containing the keywords and a list of conditions.
Return value
array A structured list of search results
Overrides SearchInterface::execute
1 call to SearchExtraTypeSearch::execute()
- SearchExtraTypeSearch::buildResults in core/
modules/ search/ tests/ modules/ search_extra_type/ src/ Plugin/ Search/ SearchExtraTypeSearch.php - Executes the search and builds render arrays for the result items.
File
-
core/
modules/ search/ tests/ modules/ search_extra_type/ src/ Plugin/ Search/ SearchExtraTypeSearch.php, line 51
Class
- SearchExtraTypeSearch
- Executes a dummy keyword search.
Namespace
Drupal\search_extra_type\Plugin\SearchCode
public function execute() {
$results = [];
if (!$this->isSearchExecutable()) {
return $results;
}
return [
[
'link' => Url::fromRoute('test_page_test.test_page')->toString(),
'type' => 'Dummy result type',
'title' => 'Dummy title',
'snippet' => new FormattableMarkup("Dummy search snippet to display. Keywords: @keywords\n\nConditions: @search_parameters", [
'@keywords' => $this->keywords,
'@search_parameters' => print_r($this->searchParameters, TRUE),
]),
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.