You are here

function search_api_live_results_pages_searches in Search API live results 7

Returns a list of search pages for the given index.

Parameters

SearchApiIndex $index: The index whose searches should be returned.

Return value

array An array of searches, keyed by their machine name. The values are arrays with the following keys:

  • name: A human-readable name for this search.
  • options: (optional) An array of options to use for this search. Type-specific options should go into the "custom" nested key in these options.
1 string reference to 'search_api_live_results_pages_searches'
search_api_live_results_search_api_live_results_types in ./search_api_live_results.module
Implements hook_search_api_live_results_types().

File

./search_api_live_results.search_api_page.inc, line 39
Contains code for integrating with the "Search pages" module.

Code

function search_api_live_results_pages_searches(SearchApiIndex $index) {
  $ret = array();
  foreach (search_api_page_load_multiple(FALSE, array(
    'index_id' => $index->machine_name,
  )) as $page) {
    $id = 'search_api_page_' . $page->id;
    $ret[$id]['name'] = $page->name;
    $ret[$id]['options']['custom']['page_id'] = $page->id;
  }
  return $ret;
}