How can i remove the label of the password and the confirm password field through hook_form_alter functionality ?
Tried the below:
$form['pass']['#title']= t(''); $form['pass']['#description']= t('');
$form['account']['pass']['pass1']['#attributes']['placeholder']= t('Password');
$form['account']['pass']['pass2']['#attributes']['placeholder']= t('Confirm Password');
But no change in the behavior.
This is the exact code that i have written in my .theme file.
function THEMENAME_form_user_pass_reset_alter(&$form, &$form_state, $form_id) {
// Get default process function array:
$element_info = element_info('password_confirm');
$process = $element_info['#process'];
// Add our process function to the array:
$process[] = 'port_process_password_confirm';
$form['account']['pass']['#process'] = $process;
}
function port_process_password_confirm($element) {
$element['pass1']['#title'] = t('New password');
$element['pass2']['#title'] = t('Confirm new password');
return $element;
}
THEMENAME
with your actual theme name then clear the cache in order for this code to work. I'm saying this because of your comment below