0

I'm trying to override the label of the picture field. I've started with the code here:

How to change the field label on my registration form? Drupal 7

function mymodule_form_alter(&$form, &$form_state, $form_id)
{
if ($form_id == 'user_profile_form') {
  dsm($form_id);
    $form['account']['picture']['#title'] = t('Profile Picture');
}
}

enter image description here

I just want to override the "PICTURE" title to something else.

2

Actual code should be:

I have used hook_form_FORM_ID_alter() instead of hook_form_alter().

function test_form_user_profile_form_alter(&$form, &$form_state) {
  // Used dpm() to check for picture array.
  $form['picture']['#title'] = t('Profile Picture');
}

Result: enter image description here

Note: The capitalization of all the character must be coming from theming layer.

Use dpm() for development: The structure has changed and the account array no longer holds picture array.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.