function apachesolr_search_preprocess_search_result in Apache Solr Search 6.3
Same name and namespace in other branches
- 8 apachesolr_search.module \apachesolr_search_preprocess_search_result()
- 7 apachesolr_search.module \apachesolr_search_preprocess_search_result()
Template preprocess for apachesolr search results.
We need to add additional entity/bundle-based templates
File
- ./
apachesolr_search.module, line 1594 - Provides a content search implementation for node content for use with the Apache Solr search application.
Code
function apachesolr_search_preprocess_search_result(&$variables) {
// If this search result is coming from our module, we want to improve the
// template potential to make life easier for themers.
if ($variables['type'] == 'apachesolr_search') {
$result = $variables['result'];
if (!empty($result['entity_type'])) {
$variables['template_files'][] = 'search_result__' . $variables['type'] . '__' . $result['entity_type'];
if (!empty($result['bundle'])) {
$variables['template_files'][] = 'search_result__' . $variables['type'] . '__' . $result['entity_type'] . '__' . $result['bundle'];
}
}
}
}