You are here

function google_cse_results_searchbox_form in Google Custom Search Engine 7.2

Same name and namespace in other branches
  1. 7.3 google_cse.theme.inc \google_cse_results_searchbox_form()
  2. 7 google_cse.theme.inc \google_cse_results_searchbox_form()

Form builder for the searchbox forms.

1 string reference to 'google_cse_results_searchbox_form'
template_preprocess_google_cse_results in ./google_cse.theme.inc
The search results page can be themed/customized.

File

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

Code

function google_cse_results_searchbox_form($form, &$form_state) {
  $form = array();
  if (variable_get('google_cse_results_display', 'here') == 'here') {
    $cof = variable_get('google_cse_cof_here', 'FORID:11');
  }
  else {
    $form['#action'] = '//' . variable_get('google_cse_domain', 'www.google.com') . '/cse';
    $cof = variable_get('google_cse_cof_google', 'FORID:0');
  }
  $form['#method'] = 'get';
  $form['cx'] = array(
    '#type' => 'hidden',
    '#value' => variable_get('google_cse_cx', ''),
  );
  $form['cof'] = array(
    '#type' => 'hidden',
    '#value' => $cof,
  );
  $form['query'] = array(
    '#type' => 'textfield',
    '#default_value' => isset($_GET['query']) ? $_GET['query'] : '',
  );
  $form['sa'] = array(
    '#type' => 'submit',
    '#value' => t('Search'),
  );
  foreach (google_cse_advanced_settings() as $parameter => $setting) {
    $form[$parameter] = array(
      '#type' => 'hidden',
      '#value' => $setting,
    );
  }
  $form['query']['#size'] = intval(variable_get('google_cse_results_searchbox_width', 40));
  $form['query']['#title'] = t('Enter your keywords');
  google_cse_sitesearch_form($form);
  return $form;
}