Theming form elements
Drupal form elements such as checkboxes and radio buttons are all rendered using the theme system and, consequently, can be overridden just like any other theme function. In this recipe, we will be adding a new feature to the FIELDSET
element by overriding theme_fieldset()
. We will be demonstrating its use by adding a postscript to the Revision information fieldset present in every node form.
Getting ready
This recipe requires the use of the mysite module created earlier in this book. The Devel and Theme developer modules will also be used to identify the theme function to override.
How to do it...
Firstly, we need to identify how Drupal is going about theming a fieldset. The recommended method of doing so is to use the Theme developer module as follows:
Browse to a node form at, for example,
node/add/story
.Locate the Revision information fieldset which, if collapsed, should be expanded.
Enable Themer info and click on an empty area in this fieldset. The ensuing pop up should...