Skip to main content

Customising the Drupal search block form

16th Dec 2007

Mike Dixon

Senior Mind

The Drupal search block form is one of those things that gets used in most themes, and frequently needs a bit of themeing to bring it in line with your target design.

The following snippet (which needs to live in your template.php file) will change the word "Search" in the submit button to "Go", and will add a title to the search terms box ...


function phptemplate_search_block_form($form) { 
  $form['search_block_form_keys']['#title']='search the site';
  $form['search_block_form_keys']['#size']=10;  
  $form['submit']['#value']='GO!';
  return drupal_render($form);
}