summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDries Buytaert2010-03-12 02:29:23 (GMT)
committerDries Buytaert2010-03-12 02:29:23 (GMT)
commitf79e4f3420b06fd87dc29b0f631b8e960b97999f (patch)
treeba1e2f5e614c5f63c71459ed262ea11999df2d83
parenteb09590717ae90716fb675d7c267210872ff4b95 (diff)
- Patch #600392 by merlinofchaos, sun: search_form() has an argument but this argument is partially ignored.
-rw-r--r--modules/search/search.module8
-rw-r--r--modules/search/search.pages.inc2
2 files changed, 6 insertions, 4 deletions
diff --git a/modules/search/search.module b/modules/search/search.module
index c82e85d..07c5211 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 355fcdc..02d283e 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;
}