You are here

function google_form_alter in Google Custom Search Engine 6

Implementation of hook_form_alter().

File

./google.module, line 44
Integrates Google Custom Search Engine with the Drupal core search API.

Code

function google_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'search_form' && $form['module']['#value'] == 'google') {
    drupal_add_js(array(
      'googleCSE' => array(
        'searchForm' => TRUE,
      ),
    ), 'setting', 'footer');
    google_cse_sitesearch_form($form);
    if (variable_get('google_cse_results_gadget', 1)) {
      $form['basic']['inline']['submit']['#suffix'] = theme('google_cse_results_gadget');
    }
    $form['#submit'][] = 'google_submit_redirect';
  }
}