Adding class to form-item I've been trying to add a custom classname to a form-item to use as a 'marker' for theming with my css file.

I've been on stackexchange/overflow and several other sites and forums, including the Drupal documentation, but found no reason why it shouldn't work.

Official documentation state the use of the attribute tag like so:

'#attributes' =&gt; array('class' =&gt; 'myclass'),


But as seen in my example below, this doesn't work or give me errors.



Am I doing something wrong?
#attributes is not supported by item form elements. 


  item
  
  Description: Generate a display-only form element allowing for an optional title and description.
  
  Note: since this is a read-only field, setting the #required property will do nothing except theme the form element to look as if it were actually required (i.e. by placing a red star next to the #title).
  
  Properties: #access, #after_build, #description, #element_validate, #parents, #post_render, #prefix, #pre_render, #required, #suffix, #theme, #title, #tree, #type, #value, #weight


You would then need to add a custom theme call such as:


function MYTHEME_preprocess_form_element(&amp;$vars) {
  $vars['#attributes']['class'][] = 'another-class';
}