Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
This paste will be private.
<?php /** * Search box form override. */ function phptemplate_search_theme_form($form) { $form['submit']['#theme'] = 'image_button'; $form['submit']['#attributes']['src'] = url(path_to_theme() .'/images/THEBUTTON.gif'); return '<div id="search" class="container-inline">'. drupal_render($form) .'</div>'; } /** * Custom form buttons. #theme attribute for buttons must be set to * "image_button" to invoke this. Values must be set through #attributes. * * Example: * $form['submit']['#theme'] = 'image_button'; * $form['submit']['#attributes']['src'] = url(path_to_theme() .'/images/search.gif'); */ function phptemplate_image_button($element) { $attributes = $element['#attributes']; if (!empty($element['#name'])) { $attributes['name'] = $element['#name']; } $attributes['class'] = (!empty($attributes['class']) ? $attributes['class'] .' ' : '') .'form-'. $element['#button_type']; $attributes['value'] = check_plain($element['#value']); return '<input type="image" '. drupal_attributes($attributes) ." />\n"; }
From the Design Piracy series on my blog: