You are here

function template_preprocess_google_cse_results in Google Custom Search Engine 6

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. 7.3 google_cse.theme.inc \template_preprocess_google_cse_results()
  4. 7 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 = array(
    'q' => isset($_GET['query']) ? $_GET['query'] : '',
    'cx' => variable_get('google_cse_cx', ''),
    'cof' => variable_get('google_cse_cof_google', 'FORID:0'),
    'sitesearch' => google_cse_sitesearch_default(),
  ) + google_cse_advanced_settings();
  $variables['results_searchbox_form'] = $variables['form'] ? drupal_get_form('google_cse_results_searchbox_form', $variables['self']) : '';
  $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', ''));
  $settings = array(
    'googleCSE' => array(
      'resultsWidth' => intval(variable_get('google_cse_results_width', 600)),
      'domain' => variable_get('google_cse_domain', 'www.google.com'),
    ),
  );
  drupal_add_js($settings, 'setting');
}