O'Reilly logo

Drupal 6 Theming Cookbook by Karthik Kumar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Replacing a standard submit button with an image button

Design requirements sometimes dictate that standard form buttons be replaced with image equivalents. In this recipe, we will be replacing the Save and Preview buttons in node creation forms with image buttons.

Getting ready

We will be using the mysite module created earlier in this book. We will be adding two image buttons—one for Save and the other for the Preview button—to the form. It is assumed that these images are available as save.png and preview.png, and stored in the myzen theme's image folder.

It is also worthwhile familiarizing ourselves with the syntax and general vagaries of the button, image_button, and submit form element types via the Form API reference manual at http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/6#image_button ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required