hook_form_alter on

Dear everyone,

On me website I successfully used hook_form_alter to add an attribute to many field on the registration page. However, I wanted the users to be able to register their first name and last names as well, so I went to “Configuration>Account settings>MANAGE FIELDS” and added a field with the machine name “field_first_name” with the type “Text”. When I use dpm on the registration page for the “form_id=user_register_form” it seems like the field “field_first_name” has a default attribute class array with 3 elements: field-type-text, field-name-field-first-name and field-widget-text-textfield. I did manage to override these with the custom attribute I used for other fields, but even when it did override the class attribute is not working, I inspect the field and it is still using the default CS style for text fields (i.e. input.form-text, input.form-text, textare.form). Can someone help me and explain why this field not obeying this new class attribute. Thank you all in advance

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/4/feed