Add css property for individual components in form elements - Drupal

16,863

Someone already answer to your question Remove class=“form-item” from Drupal forms.
That function give possibility add class='title' to the title.
But for class='text' you should theme_textfield (or theme_textarea) to own template.php
Take codes from ./included/form.inc
But i recommend to do theming required custom form, not all form elements. Somewhere it can raise styling conflicts etc. Of course, if client doesn't demand change all form elements. In real case changing default elements doesn't need.

Share:
16,863

Related videos on Youtube

Sparky
Author by

Sparky

Hakuna Matata

Updated on June 04, 2022

Comments

  • Sparky
    Sparky almost 2 years

    I have a drupal form and I need to add separate classes to the components in a form element.

    That is I need to add the attribute class='text' to the 'textbox (the actual box)' and class='title' to the 'textbox title' (#title').

    How do I do this?

Related