You are here

function search_api_live_results_views_searches in Search API live results 7

Returns a list of search views 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_views_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_views.inc, line 60
Contains code for integrating with the "Search views" module.

Code

function search_api_live_results_views_searches(SearchApiIndex $index) {
  $ret = array();
  foreach (views_get_all_views() as $name => $view) {
    if (substr($view->base_table, 0, 17) == 'search_api_index_') {

      // @todo Check whether there is an exposed fulltext filter
      $ret['search_api_views_' . $name] = array(
        'name' => $view->human_name,
      );
    }
  }
  return $ret;
}