public function SearchApiRangesAlter::propertyInfo in Search API ranges 7
Add properties to the index (Min and max) of the selected fields.
Overrides SearchApiAbstractAlterCallback::propertyInfo
File
- includes/
callback_search_api_ranges.inc, line 126
Class
- SearchApiRangesAlter
- Search API ranges data alteration callback that indexes the min and max of selected numeric fields.
Code
public function propertyInfo() {
$ret = array();
if (!empty($this->options['fields'])) {
foreach ($this->options['fields'] as $name => $field) {
// Backward compatibility with the old format.
$is_array = is_array($field);
$prefix = str_replace(':', '_', $name);
$ret[$prefix . $this->min_suffix] = array(
'label' => $is_array && !empty($field['name']) ? $field['name'] . ' (Min)' : t('Search API ranges (Min)'),
'description' => $is_array && !empty($field['description']) ? $field['description'] : '',
'type' => $is_array && !empty($field['type']) ? $field['type'] : search_api_extract_inner_type($this->index->options['fields'][$name]['type']),
);
$ret[$prefix . $this->max_suffix] = array(
'label' => $is_array && !empty($field['name']) ? $field['name'] . ' (Max)' : t('Search API ranges (Max)'),
'description' => $is_array && !empty($field['description']) ? $field['description'] : '',
'type' => $is_array && !empty($field['type']) ? $field['type'] : search_api_extract_inner_type($this->index->options['fields'][$name]['type']),
);
}
}
return $ret;
}