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'; } } /** * Redirect form submission to URL with query parameters. */ function google_submit_redirect($form, &$form_state) { $keys = $form_state['values']['processed_keys']; $sitesearch = isset($form_state['values']['sitesearch']) ? $form_state['values']['sitesearch'] : NULL; $form_state['redirect'] = array('search/google/'. $keys, google_build_query($keys, $sitesearch)); } /** * Build a query array based on Google CSE settings. */ function google_build_query($keys, $sitesearch = NULL) { return array( 'query' => $keys, 'cx' => variable_get('google_cse_cx', ''), 'cof' => variable_get('google_cse_cof_here', 'FORID:11'), 'sitesearch' => isset($sitesearch) ? $sitesearch : google_cse_sitesearch_default(), ) + google_cse_advanced_settings(); }