Porting Themes to Dupal

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by gandalf12 on October 23, 2011 at 2:13am

Hi All,

I have a test bed site http://www.drupalsorcery.com/drupalblog where I load drupal 6.x ports of themes.

There are a few now:
ChristmasDays [ex WordPress]
Terrafirma [ex Nodethreethirty - css]
Envision12 [ex CSS template]
TheHobbitt [ex WordPress - under construction]

Changing the theme is quite easy, use the drop down box and choose the theme to view.

My post is two-fold:
Comments on the themes, if I may ask that people comment on the ports and add any feedback, opinions and criticisms.

Questions on theming, I am trying to theme the search box on Christmas Days. I simply cannot for the life of me work out how to add text to the search text box [something like search here ...] that disappears when one starts to enter a search string and how to change the search button to a image button.
I have tried adding a template preprocess [code below], but I end up with errors, and the same old Drupal 6.x format to the search box!

<?php
// change MY_THEME_NAME to your actual theme name
function christmasdays_preprocess_search_block_form(&$vars, $hook) {

// Modify elements of the search form
unset($vars['form']['search_block_form']['#title']);

// Set a default value for the search box
$vars['form']['search_block_form']['#value'] = t('Search here ...');

// Add a custom class to the search box, change the text of "mycustomclass"
// Set yourtheme.css > #search-block-form .form-text { color: #888888; }
$vars['form']['search_block_form']['#attributes'] = array(
'class' => "mysearchblockclass",
'onblur' => "if (this.value == '') {this.value = '".$vars['form']['search_block_form']['#value']."';} this.style.color = '#000000';",
'onfocus' => "if (this.value == '".$vars['form']['search_block_form']['#value']."') {this.value = '';} this.style.color = '#000000';" );

// Modify elements of the submit button
// change MY_THEME_NAME to your actual theme name
// to add a class to the submit button change the text of "mybuttonclass"
//unset($vars['form']['submit']);
$vars['form']['submit']['#type'] = 'image_button';
$vars['form']['submit']['#src'] = drupal_get_path('theme', 'christmasdays') . '/images/SearchButton.gif';
$vars['form']['submit']['#attributes'] = array('class' => "mybuttonclass");
//print'<pre>';print_r($vars['form']['submit']);exit;

// Change text on the submit button
//$vars['form']['submit']['#value'] = t('Go!');

// Rebuild the rendered version (search form only, rest remains unchanged)
unset($vars['form']['search_block_form']['#printed']);
$vars['search']['search_block_form'] = drupal_render($vars['form']['search_block_form']);

// Rebuild the rendered version (submit button, rest remains unchanged)
unset($vars['form']['submit']['#printed']);
$vars['search']['submit'] = drupal_render($vars['form']['submit']);

// Collect all form elements to print entire form
$vars['search_form'] = implode($vars['search']);
}
?>

Your comments are most welcome.
Hope you are having a great "Labour Day" long weekend.

Cheers
Grant

Categories: , ,

Comments

New Zealand

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /