You are here

function apachesolr_search_preprocess_search_result in Apache Solr Search 7

Same name and namespace in other branches
  1. 8 apachesolr_search.module \apachesolr_search_preprocess_search_result()
  2. 6.3 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 1504
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['module'] == 'apachesolr_search') {
    $result = $variables['result'];
    if (!empty($result['entity_type'])) {
      $variables['theme_hook_suggestions'][] = 'search_result__' . $variables['module'] . '__' . $result['entity_type'];
      if (!empty($result['bundle'])) {
        $variables['theme_hook_suggestions'][] = 'search_result__' . $variables['module'] . '__' . $result['entity_type'] . '__' . $result['bundle'];
      }
    }
  }
}