Overriding theme_form_element in Specific cases

JeebsUK - November 16, 2009 - 11:48

Hi all,

I want to override the theme_form_element function which is easy enough in itself, but I only want to do it in certain circumstances. As I understand it you can set #theme on a form element which is picked up by drupal_render, so if I have a textfield I can set a custom theme function on the properties of the form element, but then theme_textfield calls theme('form_element').

Would I have to create my own theme_textfield (or other theme functions) which then perform an if statement to decide whether to use the original theme_form_element or my custom one? I can't see an easier way to do it.

 
 

Drupal is a registered trademark of Dries Buytaert.