Remove/Change search this site label in Drupal search form
In this article I will show you how to remove Search this site: label from Drupal's search form. Drupal add search form to a site in two ways. One way is the theme's search form which is rendered by placing $search_box variable anywhere in the theme's page.tpl.php file. And other ways is search form block that you can place to any available block region.
Removing label from theme's search form
First will will tell you how to replace Search this site: from themes search form.
<div class="container-inline">
<?php
$search["search_theme_form"]=str_replace('value=""', 'value="Enter your search term..." onblur="setTimeout(\'closeResults()\',2000); if (this.value == \'\') {this.value = \'\';}" onfocus="if (this.value == \'Enter your search term...\') {this.value = \'\';}" ', $search["search_theme_form"]);
$search["search_theme_form"]=str_replace(t('Search this site:'), '', $search["search_theme_form"]);
print $search["search_theme_form"];
print $search["submit"];
print $search["hidden"];
?>
</div>Create a file named search-theme-form.tpl.php in your themename directory and add following code to it:
Removing label from blocks's search form
Now, its time to do the same this for block search form. Create a file named search-block-form.tpl.php in your themename directory and add following code:
<div class="container-inline">
<?php
$search["search_block_form"]=str_replace(t('Search this site:'), '', $search["search_block_form"]);
print $search["search_block_form"];
print $search["submit"];
print $search["hidden"]; ?>
<?php if (isset($search['extra_field'])): ?>
<div class="extra-field">
<?php print $search['extra_field']; ?>
</div>
<?php endif; ?>
</div>







Comments on this post
Is this for your premium theme or for drupal in general?
Its in general for Drupal