You are here

function apachesolr_search_preprocess_search_result in Apache Solr Search 8

Same name and namespace in other branches
  1. 6.3 apachesolr_search.module \apachesolr_search_preprocess_search_result()
  2. 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 1452
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'];
      }
    }
  }
}