form_process_password_confirm

  1. drupal
    1. 8
    2. 7
Versions
7 – 8 form_process_password_confirm($element)

Expand a password_confirm field into two text boxes.

Related topics

Code

includes/form.inc, line 2752

<?php
function form_process_password_confirm($element) {
  $element['pass1'] =  array(
    '#type' => 'password', 
    '#title' => t('Password'), 
    '#value' => empty($element['#value']) ? NULL : $element['#value']['pass1'], 
    '#required' => $element['#required'], 
    '#attributes' => array('class' => array('password-field')),
  );
  $element['pass2'] =  array(
    '#type' => 'password', 
    '#title' => t('Confirm password'), 
    '#value' => empty($element['#value']) ? NULL : $element['#value']['pass2'], 
    '#required' => $element['#required'], 
    '#attributes' => array('class' => array('password-confirm')),
  );
  $element['#element_validate'] = array('password_confirm_validate');
  $element['#tree'] = TRUE;

  if (isset($element['#size'])) {
    $element['pass1']['#size'] = $element['pass2']['#size'] = $element['#size'];
  }

  return $element;
}
?>