Matt Haughey (MetaFilter) once said, “Forms are tedious, confusing, often poorly designed, and most people equate their use with things like paying taxes.” Forms are often overlooked by themers because the code seems complicated and the forms are good enough that the hassle of learning the code does not seem to be worth the trouble. But in Drupal 6 theming forms has gotten a WHOLE LOT EASIER!
In this session you will learn how to make your forms look the way you want. We\'ll start by looking at some great helper modules you can install to make forms a little sleeker. And then we\'ll move on to the basics of using the developer module to identify, and theme, form components. We\'ll specifically look at altering CCK forms although the techniques will apply to other Drupal forms too!
If you\'ve had tears of joy or tears of frustration from theming forms in Drupal 6, please bring your experiences to share with others.
This talk is based on content from Front End Drupal—a Drupal theming book published by Pearson Education. You can read it in draft format at http://safari.informit.com/9780137007752. The print publication should be available Spring 2009 ish.
2. About this talk
● Matt Haughey (MetaFilter) once said, “Forms are tedious, confusing, often
poorly designed, and most people equate their use with things like paying
taxes.” Forms are often overlooked by themers because the code seems
complicated and the forms are good enough that the hassle of learning the
code does not seem to be worth the trouble. But in Drupal 6 theming forms
has gotten a WHOLE LOT EASIER!
● In this session you will learn how to make your forms look the way you want.
We'll start by looking at some great helper modules you can install to make
forms a little sleeker. And then we'll move on to the basics of using the
developer module to identify, and theme, form components. We'll specifically
look at altering CCK forms although the techniques will apply to other Drupal
forms too!
● If you've had tears of joy or tears of frustration from theming forms in Drupal 6,
please bring your experiences to share with others.
● This talk is based on content from Front End Drupal—a Drupal theming book
published by Pearson Education. You can read it in draft format at
http://safari.informit.com/9780137007752. The print publication should be
available Spring 2009 ish.
40. 9
Reset (or unset) form values
function THEMENAME_form_id ($form) {
// set your new form data/values/text/etc
$form['buttons']['submit']['#value'] = “YARR”;
$form['title']['#title'] = t('New label text');
// put the values back into the Drupal form
return (drupal_render($form));
}
41. 10
API.drupal.org is also your friend.
http://api.drupal.org/api/group/themeable/6
http://api.drupal.org/api/file/developer/topics/forms_api_reference.html