1 form.inc | form_process_password_confirm($element) |
Expand a password_confirm field into two text boxes.
Related topics
File
- core/
includes/ form.inc, line 3020 - Functions for form and batch generation and processing.
Code
function form_process_password_confirm($element) {
$element['pass1'] = array(
'#type' => 'password',
'#title' => t('New password'),
'#value' => empty($element['#value']) ? NULL : $element['#value']['pass1'],
'#required' => $element['#required'],
'#attributes' => $element['#attributes'] + array('class' => array('password-field')),
'#password_strength' => TRUE,
'#password_shown' => FALSE,
'#password_toggle' => FALSE,
);
$element['pass2'] = array(
'#type' => 'password',
'#title' => t('Confirm new password'),
'#value' => empty($element['#value']) ? NULL : $element['#value']['pass2'],
'#required' => $element['#required'],
'#attributes' => $element['#attributes'] + array('class' => array('password-confirm')),
'#password_strength' => FALSE,
'#password_shown' => FALSE,
'#password_toggle' => FALSE,
);
$element['#element_validate'] = array('password_confirm_validate');
$element['#tree'] = TRUE;
if (isset($element['#size'])) {
$element['pass1']['#size'] = $element['pass2']['#size'] = $element['#size'];
}
return $element;
}