diff --git a/modules/search/search.module b/modules/search/search.module index c82e85d1ade5cdb2af02ca8fecac1ee786e2981a..07c52112f8ce125e2f495ec6cc48388806751cb8 100644 --- a/modules/search/search.module +++ b/modules/search/search.module @@ -876,7 +876,7 @@ function search_get_keys() { * Render a search form. * * @param $action - * Form action. Defaults to "search". + * Form action. Defaults to "search/$type". This will be run through url(). * @param $keys * The search string entered by the user, containing keywords for the search. * @param $type @@ -892,13 +892,15 @@ function search_form($form, &$form_state, $action = '', $keys = '', $type = NULL drupal_add_css(drupal_get_path('module', 'search') . '/search.css', array('preprocess' => FALSE)); if (!$action) { - $action = url('search/' . $type); + $action = 'search/' . $type; } if (is_null($prompt)) { $prompt = t('Enter your keywords'); } - $form['#action'] = $action; + $form['#action'] = url($action); + // Record the $action for later use in redirecting. + $form_state['action'] = $action; $form['#attributes']['class'][] = 'search-form'; $form['module'] = array('#type' => 'value', '#value' => $type); $form['basic'] = array('#type' => 'container', '#attributes' => array('class' => array('container-inline'))); diff --git a/modules/search/search.pages.inc b/modules/search/search.pages.inc index 355fcdc5d87f8f4e6488cf22accfeb9bac0ec8e8..02d283e70b5fa2eb93d3812dc947af1cbff99233 100644 --- a/modules/search/search.pages.inc +++ b/modules/search/search.pages.inc @@ -136,6 +136,6 @@ function search_form_submit($form, &$form_state) { } $type = $form_state['values']['module'] ? $form_state['values']['module'] : 'node'; - $form_state['redirect'] = 'search/' . $type . '/' . $keys; + $form_state['redirect'] = $form_state['action'] . '/' . $keys; return; }