You are here

function template_preprocess_google_cse_results in Google Custom Search Engine 7

Same name and namespace in other branches
  1. 8.3 google_cse.theme.inc \template_preprocess_google_cse_results()
  2. 8.2 google_cse.theme.inc \template_preprocess_google_cse_results()
  3. 6 google_cse.theme.inc \template_preprocess_google_cse_results()
  4. 7.3 google_cse.theme.inc \template_preprocess_google_cse_results()
  5. 7.2 google_cse.theme.inc \template_preprocess_google_cse_results()

The search results page can be themed/customized.

File

./google_cse.theme.inc, line 11
Themeable functions for Google Custom Search Engine.

Code

function template_preprocess_google_cse_results(&$variables) {
  $query = google_cse_build_query(isset($_GET['query']) ? $_GET['query'] : '', NULL, FALSE);
  $variables['results_searchbox_form'] = $variables['form'] ? drupal_get_form('google_cse_results_searchbox_form') : '';
  $variables['noscript'] = t('!google, or enable JavaScript to view them here.', array(
    '!google' => l(t('View the results at Google'), 'http://' . variable_get('google_cse_domain', 'www.google.com') . '/cse', array(
      'query' => $query,
    )),
  ));
  $variables['prefix'] = filter_xss_admin(variable_get('google_cse_results_prefix', ''));
  $variables['suffix'] = filter_xss_admin(variable_get('google_cse_results_suffix', ''));
  if (google_cse_validate_request()) {
    drupal_add_js($variables['path'] . '/google_cse_results.js', array(
      'scope' => 'footer',
    ));
    drupal_add_js('https://www.google.com/afsonline/show_afs_search.js', array(
      'type' => 'external',
      'scope' => 'footer',
    ));
  }
}