Remove class="form-item" from Drupal forms

Sparky picture Sparky · Feb 16, 2011 · Viewed 8.1k times · Source


Drupal automatically adds <div>'s and classes around form items. All form elements will have the attribute class = "form-item". How do I override this default behavior?

Answer

Matt V. picture Matt V. · Feb 16, 2011

If you insist on changing it, it's added in the theme_form_element function. You can override it by copying that function to your theme's template.php file and renaming it THEMENAME_form_element (substituting the name of your theme in place of "THEMENAME") or phptemplate_form_element and removing the part that adds the class.