Modify how Drupal builds fields on a per form basis I want to change the way Drupal builds specific fields on a specific node edit/add form on my site. For example, when I use print drupal_render($form['textarea']); in my node--CONTENTTYPE--form.tpl.php file, I get the default Drupal render of the field widget. I want to modify the HTML markup of the field widget.

There are three ways I can think of that might solve this problem:


Using a forms equivalent of the theme_field() hook. This seems ideal, but after searching for the last few hours, I haven't found anything on this.
Building custom field widgets for every field type I'm using on that node. This is definitely not ideal and I have to believe there's an easy way to do this in Drupal from a theme point of view.
Manually build the HTML markup for the form and field in node--CONTENTTYPE--form.tpl.php with print $form['textarea']['und'][0]['title']; and the like.


Is there a hook in Drupal to do this, or must the code for every field I want to modify be manually generated?
I think your third option is the most direct solution since you are only looking to change one form and that file will only be called when you use that form.

The only alternative I can think of is to use hook_form_FORM_ID_alter and iterate through the form items, putting html into the #prefix and #suffix values; or creating #attribute['class'] or #attribute['style'] values depending on what you are trying to achieve.