Index: search.module =================================================================== RCS file: /cvs/drupal/drupal/modules/search.module,v retrieving revision 1.112 diff -u -r1.112 search.module --- search.module 15 Jan 2005 09:03:39 -0000 1.112 +++ search.module 22 Feb 2005 21:44:03 -0000 @@ -70,6 +70,22 @@ } /** + * Implementation of hook_block(). + */ +function search_block($op = 'list', $delta = 0) { + global $user; + if ($op == 'list') { + $blocks[0]['info'] = t('Search'); + return $blocks; + } + else if ($op == 'view' && user_access('search content') && arg(0) != 'search') { + $block['content'] = search_form('', '', null, ''); + $block['subject'] = t('Search'); + return $block; + } +} + +/** * Implementation of hook_menu(). */ function search_menu($may_cache) { @@ -579,7 +595,7 @@ * @return * An HTML string containing the search form. */ -function search_form($action = '', $keys = '', $type = null) { +function search_form($action = '', $keys = '', $type = null, $prompt = null) { $edit = $_POST['edit']; if (!$action) { @@ -588,13 +604,16 @@ if (!$type) { $type = 'node'; } + if (is_null($prompt)) { + $prompt = t('Enter your keywords'); + } $output = '
'; $box = '
'; $box .= form_textfield('', 'keys', $keys, 40, 255); $box .= form_submit(t('Search'));; $box .= '
'; - $output .= form_item(t('Enter your keywords'), $box); + $output .= form_item($prompt, $box); $output .= form_hidden('type', $type); $output .= '
';