function search_api_ranges_map_label in Search API ranges 7
Maps facet ranges to their human readable label.
Parameters
$values: An array of ranges being mapped.
$options: An associative array of map options.
Return value
An array mapping the ranges to their human readable label.
1 string reference to 'search_api_ranges_map_label'
File
- ./
search_api_ranges.module, line 686 - Performs min/max queries through Search API and provides UI Slider display widget for Facet API
Code
function search_api_ranges_map_label(array $values, array $options) {
$adapter = facetapi_adapter_load('search_api@' . $options['index id']);
$facet_settings = $adapter
->getFacet(array(
'name' => $options['field']['key'],
))
->getSettings('block');
$map = array();
if (!empty($facet_settings->settings['range_advanced'])) {
$ranges = preg_split('/[\\r\\n]+/', $facet_settings->settings['range_advanced']);
foreach ($ranges as $item) {
$item = explode('|', $item, 2);
if (isset($item[1])) {
$item[0] = '[' . str_replace('-', ' TO ', $item[0]) . ']';
$map[$item[0]] = $item[1];
}
}
}
return $map;
}