The request seems simple, change the password field title in user edit form to “New Password” (or add placeholder etc)
From:
to:
Try to alter user_profile_form but no luck, there is a form element in <?php $form['account']['pass']['#type'] = 'password_confirm';?>
Don’t have #title to change
And actually ‘password_confirm’ is rendered in form_process_password_confirm()
with no alter available.
So I took another route in form API #pre_render
<?php
function hook_form_user_profile_form_alter(&$form, &$form_state) {
$form['#pre_render'][] = 'hook_form_user_profile_form_pre_render';
}
function hook_form_user_profile_form_pre_render($elements) {
$elements['account']['pass']['pass1']['#title'] = t('New password');
$elements['account']['pass']['pass2']['#title'] = t('Confirm new password');
return $elements;
}
?>
Attachment | Size |
---|---|
Screen Shot 2015-03-04 at 4.39.39 pm.png | 19.86 KB |
Screen Shot 2015-03-04 at 4.40.53 pm.png | 18.77 KB |