function availability_calendar_get_search_api_availability_index_table in Availability Calendars 7.5
Searches for an index that indexes availability calendars and returns the table name of the table that contains the indexed availability.
Parameters
string $server_name: The server on which the index should reside.
Return value
string
1 call to availability_calendar_get_search_api_availability_index_table()
- availability_calendar_views_data_alter in views/
availability_calendar.views.inc - Implements hook_views_data_alter().
File
- views/
availability_calendar.views.inc, line 234 - Views support for Availability Calendar.
Code
function availability_calendar_get_search_api_availability_index_table($server_name) {
if (module_exists('search_api')) {
$indices = search_api_index_load_multiple(FALSE);
foreach ($indices as $index) {
$server = search_api_server_load($server_name);
if ($server) {
$options = $server->options;
// Get table that contains the filtered availability.
if (!empty($options['indexes'][$index->machine_name])) {
foreach ($options['indexes'][$index->machine_name] as $key => $option) {
if (substr($key, -strlen('filtered_availability')) === 'filtered_availability' && isset($option['table'])) {
return $option['table'];
}
}
}
}
}
}
return NULL;
}