I would like to add a value for the search box input to my Bartik subtheme, and modify the value in my Clean Coorporate subtheme. How would I do this?
Edit: Found this code in template.php for the clean coorporate theme. Editing the 'Search' string updated the value I was wanting to change. I guess I just need to put the same code in my Bartik subtheme as well?
function mytheme_form_alter(&$form, &$form_state, $form_id) { if ($form_id == 'search_block_form') {
function mytheme_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'search_block_form') {
unset($form['search_block_form']['#title']);
$form['search_block_form']['#title_display'] = 'invisible';
$form_default = t('Search this site');
$form['search_block_form']['#default_value'] = $form_default;
$form['actions']['submit'] = array('#type' => 'image_button', '#src' => base_path() . path_to_theme() . '/images/search-button.png');
$form['search_block_form']['#attributes'] = array('onblur' => "if (this.value == '') {this.value = '{$form_default}';}", 'onfocus' => "if (this.value == '{$form_default}') {this.value = '';}" );
}
}
} }