Same name and namespace in other branches
  1. 4.7.x includes/form.inc \expand_password_confirm()
  2. 6.x includes/form.inc \expand_password_confirm()

Expand a password_confirm field into two text boxes.

Related topics

File

includes/form.inc, line 1112

Code

function expand_password_confirm($element) {
  $element['pass1'] = array(
    '#type' => 'password',
    '#title' => t('Password'),
    '#value' => $element['#value']['pass1'],
    '#required' => $element['#required'],
  );
  $element['pass2'] = array(
    '#type' => 'password',
    '#title' => t('Confirm password'),
    '#value' => $element['#value']['pass2'],
    '#required' => $element['#required'],
  );
  $element['#validate'] = array(
    'password_confirm_validate' => array(),
  );
  $element['#tree'] = TRUE;
  if (isset($element['#size'])) {
    $element['pass1']['#size'] = $element['pass2']['#size'] = $element['#size'];
  }
  return $element;
}