So, it has been a while since I last blogged, probably because I have had a lot of work on recently, which certainly isn’t something to complain about. The latest little snippet I have for you is concerning webforms, and more specifically overriding the submit button with an image button.

Basically when I searched around drupal.org, I found a range of differing answers, none of which appeared to solve the problem for me.

So, you have a little webform that you have made, whack this in the template.php of your theme file to complete the override:

function THEMENAME_webform_form_(NID)($form) {
style="margin-left: 40px;"
    $output = '';
    $form['actions']['submit'] = array(
        '#type' => 'image_button',
        '#value' => t(' '),
        '#src' => 'sites/$new_url/files/submit-button.png',
    );

    $output = drupal_render($form);
    return $output;
}

Please remember to replace THEMENAME with the name of your theme and NID with the node id of your webform.

This works as opposed to $form['submit'] which works for the search block, or $form['submitbutton'] which appears to work somewhat but does not display.

Until next time…