Skip to main content

Customising the Drupal search block form

An article from ComputerMinds - Building with Drupal in the UK since 2005
16th Dec 2007

Mike Dixon

Senior Mind
Hey, you seem to look at this article a lot! Why not Bookmark this article so you can find it easily in the future?

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);
}

Hi, thanks for reading

ComputerMinds are the UK’s Drupal specialists with offices in Bristol and Coventry. We offer a range of Drupal services including Consultancy, Development, Training and Support. Whatever your Drupal problem, we can help.