Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • Thanks for your help! I've tried your code, but it doesn't seem to add the class. I have tried several modifications of the code and have found something interesting that happens when I use this code: function THEMENAME_preprocess_form_element(&$variables) { $variables['element']['#attributes']['class'] .= ' myclass'; kpr($variables); } With this code, the new class doesn't appear in the HTML, but it does appear in the KPR Message (when using Devel). I'd apperciate any ideas you can offer so I can make the class appear in the HTML. Commented Feb 10, 2013 at 19:02
  • Sorry I didn't check the theme function beforehand, this was more of a general response. The $attributes array is actually initialised in theme_form_element itself so in this case there's no way to override it without overriding the whole theme function I'm afraid Commented Feb 10, 2013 at 19:05