You are here

function _search_api_saved_searches_settings_options_list in Search API Saved Searches 7

Retrieves the options list for selecting a saved search settings entity.

Return value

string[] An associative array mapping saved search settings IDs to index names.

1 string reference to '_search_api_saved_searches_settings_options_list'
search_api_saved_searches_rules_action_info in ./search_api_saved_searches.rules.inc
Implements hook_rules_action_info().

File

./search_api_saved_searches.rules.inc, line 65
Rules integration for the Search API Saved Searches module.

Code

function _search_api_saved_searches_settings_options_list() {

  // Fetch the list of saved searches setting and make a list of values.
  $entities = entity_load('search_api_saved_searches_settings');
  $ids = array();
  foreach ($entities as $entity) {
    $ids[$entity->index_id][] = $entity->id;
  }
  $indexes = search_api_index_load_multiple(array_keys($ids));
  $options = array();
  foreach ($indexes as $index_id => $index) {
    foreach ($ids[$index_id] as $settings_id) {
      $options[$settings_id] = $index
        ->label();
    }
  }
  return $options;
}