Skip to main content
edited tags
Link
No Sssweat
  • 31.6k
  • 14
  • 55
  • 91
code formatting
Source Link
Clive
  • 167.9k
  • 19
  • 303
  • 337

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 = '';}" );
  }
}

} }

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') {

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 = '';}" );

} }

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') {
    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 = '';}" );
  }
}
added 901 characters in body
Source Link
kine456
  • 1.2k
  • 2
  • 29
  • 73

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') {

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 = '';}" );

} }

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?

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') {

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 = '';}" );

} }

Source Link
kine456
  • 1.2k
  • 2
  • 29
  • 73
Loading