You are here

function google_appliance_preprocess_search_result in Google Search Appliance 6.2

Process variables for search-result.tpl.php. See search-result.tpl.php

File

./google_appliance.module, line 469
Google Search Appliance (GSA) / Google Mini integration

Code

function google_appliance_preprocess_search_result(&$variables) {
  static $mime_types;
  $result = $variables['result'];

  // Only preprocess the results of a Google Appliance search.
  if (empty($result['google_appliance'])) {
    return;
  }

  // Attributes
  $variables['attributes'] = $result['attributes'];
  if (!isset($mime_types)) {
    $mime_types = google_appliance_mime_types();
  }
  if (!empty($result['attributes']['MIME'])) {
    if (!empty($mime_types[$result['attributes']['MIME']])) {
      $variables['mime'] = $mime_types[$result['attributes']['MIME']];
    }
  }

  // Meta data
  $variables['meta_data'] = $result['meta_data'];

  // Allow optional search-result-google-appliance.tpl.php in theme.
  $variables['template_files'][] = 'search-result-google-appliance';
}