I simply want the ability to remove the default text "Search this site: " from the $search_box variable when theming in Drupal 6, as well as possibly changing the submit button's text from "Search" to "Go!" or something like that... The way I think this function should be overridden is below. I can't see why it's not working.

Comments

krlkv’s picture

Also would like to see how to override this function properly.

Anonymous’s picture

deleted

coupet’s picture

Customizing Search Block Form in Drupal 6.0
http://drupal.org/node/232874

----
Darly

Anonymous’s picture

As I understand it, the $search_box and search block are two different things...

coupet’s picture

function search_forms() {
  $forms['search_theme_form']= array(
    'callback' => 'search_box',
    'callback arguments' => array('search_theme_form'),
  );
  $forms['search_block_form']= array(
    'callback' => 'search_box',
    'callback arguments' => array('search_block_form'),
  );
  return $forms;
function search_theme() {
  return array(
    'search_theme_form' => array(
      'arguments' => array('form' => NULL),
      'template' => 'search-theme-form',
    ),
    'search_block_form' => array(
      'arguments' => array('form' => NULL),
      'template' => 'search-block-form',
    ),
    'search_result' => array(
      'arguments' => array('result' => NULL, 'type' => NULL),
      'file' => 'search.pages.inc',
      'template' => 'search-result',
    ),
    'search_results' => array(
      'arguments' => array('results' => NULL, 'type' => NULL),
      'file' => 'search.pages.inc',
      'template' => 'search-results',
    ),
  );
}

----
Darly

coupet’s picture

How I changed the Search Box in Drupal 6
http://drupal.org/node/232874#comment-779380

----
Darly

Anonymous’s picture

With Darly's links to pointers to some information I had not run across previously, I was finally able to put things I had seen in several different places together

hass’s picture

Your example does not remove the label tag. This one should solve this issue.

<?php
// $Id: search-theme-form.tpl.php,v 1.0 2008/06/14 10:10:00 hass Exp $
?>
<div id="search" class="container-inline">
  <?php
  $search['search_theme_form'] = preg_replace('/<label(.*)>(.*)<\/label>\n/i', '', $search['search_theme_form']);
  print $search['search_theme_form'];
  print $search['submit'];
  print $search['hidden'];
  ?>
</div>
kaido.toomingas’s picture

Thanks for a great tutorial. But can you make this work with multilingual sites? I got this to work when I removed translation strings but still I think there is a better way ;)

I got this to work now!

Thanks you both Purrin and Hass :)