Index: modules/search.module =================================================================== RCS file: /cvs/drupal/drupal/modules/search.module,v retrieving revision 1.124 diff -U3 -r1.124 search.module --- modules/search.module 11 Apr 2005 22:48:27 -0000 1.124 +++ modules/search.module 16 Apr 2005 16:23:16 -0000 @@ -79,7 +79,7 @@ return $blocks; } else if ($op == 'view' && user_access('search content') && arg(0) != 'search') { - $block['content'] = search_form('', '', null, ''); + $block['content'] = theme('search_form', '', '', null, ''); $block['subject'] = t('Search'); return $block; } @@ -595,7 +595,7 @@ // Construct the search form. // Note, we do this last because of the form_set_error() above. - $output = search_form(NULL, $keys, $type); + $output = theme('search_form', NULL, $keys, $type); $output .= $results; @@ -635,45 +635,6 @@ */ /** - * Render a search form. - * - * @param $action - * Form action. Defaults to "search". - * @param $keys - * The search string entered by the user, containing keywords for the search. - * @param $type - * The type of search to render the node for. Must be the name of module - * which implements hook_search(). Defaults to 'node'. - * @param $prompt - * A piece of text to put before the form (e.g. "Enter your keywords") - * @return - * An HTML string containing the search form. - */ -function search_form($action = '', $keys = '', $type = null, $prompt = null) { - $edit = $_POST['edit']; - - if (!$action) { - $action = url('search/'. $type); - } - if (!$type) { - $type = 'node'; - } - if (is_null($prompt)) { - $prompt = t('Enter your keywords'); - } - - $output = '
'; - $box = '
'; - $box .= form_textfield('', 'keys', $keys, $prompt ? 40 : 20, 255); - $box .= form_submit(t('Search')); - $box .= '
'; - $output .= form_item($prompt, $box); - $output .= '
'; - - return form($output, 'post', $action); -} - -/** * Perform a standard search on the given keys, and return the formatted results. */ function search_data($keys = NULL, $type = 'node') { @@ -853,5 +814,45 @@ return $output; } +/** + * Render a search form. + * + * @param $action + * Form action. Defaults to "search". + * @param $keys + * The search string entered by the user, containing keywords for the search. + * @param $type + * The type of search to render the node for. Must be the name of module + * which implements hook_search(). Defaults to 'node'. + * @param $prompt + * A piece of text to put before the form (e.g. "Enter your keywords") + * @return + * An HTML string containing the search form. + * + * @ingroup themeable + */ +function theme_search_form($action = '', $keys = '', $type = null, $prompt = null) { + $edit = $_POST['edit']; + + if (!$action) { + $action = url('search/'. $type); + } + if (!$type) { + $type = 'node'; + } + if (is_null($prompt)) { + $prompt = t('Enter your keywords'); + } + + $output = '
'; + $box = '
'; + $box .= form_textfield('', 'keys', $keys, $prompt ? 40 : 20, 255); + $box .= form_submit(t('Search')); + $box .= '
'; + $output .= form_item($prompt, $box); + $output .= '
'; + + return form($output, 'post', $action); +} ?>