summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2006-04-06 13:07:22 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2006-04-06 13:07:22 +0000
commitcfe001af7a26926f02672275dcd516841fc1b985 (patch)
tree938e2bde84787a01e8d5932cf587a1dccb77b30a /modules
parentbe0b774cbcae15a664eff0f308b436aabd6f3dd0 (diff)
downloadbrdo-cfe001af7a26926f02672275dcd516841fc1b985.tar.gz
brdo-cfe001af7a26926f02672275dcd516841fc1b985.tar.bz2
#56457: Allow different search forms to coexist without breaking validation
Diffstat (limited to 'modules')
-rw-r--r--modules/search.module44
-rw-r--r--modules/search/search.module44
-rw-r--r--modules/system.module19
-rw-r--r--modules/system/system.module19
4 files changed, 80 insertions, 46 deletions
diff --git a/modules/search.module b/modules/search.module
index 59972ef0b..97897c0ca 100644
--- a/modules/search.module
+++ b/modules/search.module
@@ -137,8 +137,8 @@ function search_block($op = 'list', $delta = 0) {
$blocks[0]['info'] = t('Search form');
return $blocks;
}
- else if ($op == 'view' && user_access('search content') && arg(0) != 'search') {
- $block['content'] = search_form('', '', null, '');
+ else if ($op == 'view' && user_access('search content')) {
+ $block['content'] = search_box('search_block_form');
$block['subject'] = t('Search');
return $block;
}
@@ -1023,8 +1023,44 @@ function search_form_submit($form_id, $form_values) {
return 'search/'. $type .'/'. $keys;
}
-function search_box_submit($form_id, $form_values) {
- return 'search/node/'. trim($form_values['keys']);
+/**
+ * Output a search form for the search block and the theme's search box.
+ */
+function search_box($form_id = 'search_theme_form') {
+ // Use search_keys instead of keys to avoid ID conflicts with the search block.
+ $form[$form_id .'_keys'] = array(
+ '#type' => 'textfield',
+ '#size' => 15,
+ '#default_value' => '',
+ '#attributes' => array('title' => t('Enter the terms you wish to search for.')),
+ );
+ if ($form_id == 'search_theme_form') {
+ $form['#theme']['theme_search_theme_form'] = array();
+ }
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Search'));
+
+ return drupal_get_form($form_id, $form, 'search_box_form');
+}
+
+/**
+ * Process a block search form submission.
+ */
+function search_box_form_submit($form_id, $form_values) {
+ return 'search/node/'. trim($form_values[$form_id .'_keys']);
+}
+
+/**
+ * Theme the theme search form.
+ */
+function theme_search_theme_form($form) {
+ return '<div id="search" class="container-inline">'. form_render($form) .'</div>';
+}
+
+/**
+ * Theme the block search form.
+ */
+function theme_search_block_form($form) {
+ return '<div class="container-inline">'. form_render($form) .'</div>';
}
/**
diff --git a/modules/search/search.module b/modules/search/search.module
index 59972ef0b..97897c0ca 100644
--- a/modules/search/search.module
+++ b/modules/search/search.module
@@ -137,8 +137,8 @@ function search_block($op = 'list', $delta = 0) {
$blocks[0]['info'] = t('Search form');
return $blocks;
}
- else if ($op == 'view' && user_access('search content') && arg(0) != 'search') {
- $block['content'] = search_form('', '', null, '');
+ else if ($op == 'view' && user_access('search content')) {
+ $block['content'] = search_box('search_block_form');
$block['subject'] = t('Search');
return $block;
}
@@ -1023,8 +1023,44 @@ function search_form_submit($form_id, $form_values) {
return 'search/'. $type .'/'. $keys;
}
-function search_box_submit($form_id, $form_values) {
- return 'search/node/'. trim($form_values['keys']);
+/**
+ * Output a search form for the search block and the theme's search box.
+ */
+function search_box($form_id = 'search_theme_form') {
+ // Use search_keys instead of keys to avoid ID conflicts with the search block.
+ $form[$form_id .'_keys'] = array(
+ '#type' => 'textfield',
+ '#size' => 15,
+ '#default_value' => '',
+ '#attributes' => array('title' => t('Enter the terms you wish to search for.')),
+ );
+ if ($form_id == 'search_theme_form') {
+ $form['#theme']['theme_search_theme_form'] = array();
+ }
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Search'));
+
+ return drupal_get_form($form_id, $form, 'search_box_form');
+}
+
+/**
+ * Process a block search form submission.
+ */
+function search_box_form_submit($form_id, $form_values) {
+ return 'search/node/'. trim($form_values[$form_id .'_keys']);
+}
+
+/**
+ * Theme the theme search form.
+ */
+function theme_search_theme_form($form) {
+ return '<div id="search" class="container-inline">'. form_render($form) .'</div>';
+}
+
+/**
+ * Theme the block search form.
+ */
+function theme_search_block_form($form) {
+ return '<div class="container-inline">'. form_render($form) .'</div>';
}
/**
diff --git a/modules/system.module b/modules/system.module
index ae7d2580d..54182afaa 100644
--- a/modules/system.module
+++ b/modules/system.module
@@ -1211,25 +1211,6 @@ function system_theme_settings($key = '') {
}
/**
- * Output a search form.
- */
-function search_box($path = NULL) {
- $form['keys'] = array('#type' => 'textfield', '#size'=> 15, '#default_value' => '', '#attributes' => array('alt' => t('Enter the terms you wish to search for.')));
- $form['submit'] = array('#type' => 'submit', '#value' => t('Search'));
- return drupal_get_form('search_box', $form);
-}
-
-/**
- * Theme a search form.
- */
-function theme_search_box($form) {
- $output = '<div id="search" class="container-inline">';
- $output .= form_render($form);
- $output .= '</div>';
- return $output;
-}
-
-/**
* Output a confirmation form
*
* This function outputs a complete form for confirming an action. A link is
diff --git a/modules/system/system.module b/modules/system/system.module
index ae7d2580d..54182afaa 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -1211,25 +1211,6 @@ function system_theme_settings($key = '') {
}
/**
- * Output a search form.
- */
-function search_box($path = NULL) {
- $form['keys'] = array('#type' => 'textfield', '#size'=> 15, '#default_value' => '', '#attributes' => array('alt' => t('Enter the terms you wish to search for.')));
- $form['submit'] = array('#type' => 'submit', '#value' => t('Search'));
- return drupal_get_form('search_box', $form);
-}
-
-/**
- * Theme a search form.
- */
-function theme_search_box($form) {
- $output = '<div id="search" class="container-inline">';
- $output .= form_render($form);
- $output .= '</div>';
- return $output;
-}
-
-/**
* Output a confirmation form
*
* This function outputs a complete form for confirming an action. A link is