Modifying individual field form inputs (CSS, Placeholder, etc) Drupal 7 registration form preprocess

214 views Asked by At

I'm attempting to preprocess CSS and placeholder etc to the form inputs for the Registration Form. I'm manually rendering each field input on the registration form.

The following code works fine for email or password, but not 'custom fields'.

$form['account']['mail']['#attributes']['placeholder'] = t('Email address');
    $form['account']['mail']['#attributes']['class'][] = 'email-input';
    $form['account']['mail']['#title_display'] = "invisible";
    $form['account']['mail']['#description'] = t('');

When I apply the same to the custom fields, it won't apply. I have looked through the user module and printed avialable varibles

$form['field_first_name']['#attributes']['placeholder'] = t('First Name');
    $form['field_first_name']['#attributes']['class'][] = 'first-name-input';
    $form['field_first_name']['#title_display'] = "invisible";
    $form['field_first_name']['#description'] = t('');

I found multiple mentions of field_first_name in the variable print out, but I'm unable to modify the text inputs directly.

0

There are 0 answers