modules/acm/src/Element/AcmPasswordUpdate.php
public static function processPasswordUpdate(&$element, FormStateInterface $form_state, &$complete_form) {
    $element['oldpass'] = [
      '#type' => 'password',
      '#title' => t('Old Password'),
      '#value' => empty($element['#value']) ? NULL : $element['#value']['oldpass'],
      '#required' => $element['#required'],
      '#error_no_message' => TRUE,
    ];
    $element['pass1'] = [
      '#type' => 'password',
      '#title' => t('Password'),
      '#value' => empty($element['#value']) ? NULL : $element['#value']['pass1'],
      '#required' => $element['#required'],
      '#attributes' => ['class' => ['password-field', 'js-password-field']],
      '#error_no_message' => TRUE,
    ];
    $element['pass2'] = [
      '#type' => 'password',
      '#title' => t('Confirm password'),
      '#value' => empty($element['#value']) ? NULL : $element['#value']['pass2'],
      '#required' => $element['#required'],
      '#attributes' => ['class' => ['password-confirm', 'js-password-confirm']],
      '#error_no_message' => TRUE,
    ];
    $element['#element_validate'] = [[get_called_class(), 'validatePasswordUpdate']];
    $element['#tree'] = TRUE;

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

    return $element;
  }
public static function processPasswordUpdate(&$element, FormStateInterface $form_state, &$complete_form) {
    $element['oldpass'] = [
      '#type' => 'password',
      '#title' => t('Old Password'),
      '#value' => empty($element['#value']) ? NULL : $element['#value']['oldpass'],
      '#required' => $element['#required'],
      '#error_no_message' => TRUE,
    ];
    $element['pass1'] = [
      '#type' => 'password',
      '#title' => t('Password'),
      '#value' => empty($element['#value']) ? NULL : $element['#value']['pass1'],
      '#required' => $element['#required'],
      '#attributes' => ['class' => ['password-field', 'js-password-field']],
      '#error_no_message' => TRUE,
    ];
    $element['pass2'] = [
      '#type' => 'password',
      '#title' => t('Confirm password'),
      '#value' => empty($element['#value']) ? NULL : $element['#value']['pass2'],
      '#required' => $element['#required'],
      '#attributes' => ['class' => ['password-confirm', 'js-password-confirm']],
      '#error_no_message' => TRUE,
    ];
    $element['#element_validate'] = [[get_called_class(), 'validatePasswordUpdate']];
    $element['#tree'] = TRUE;

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

    return $element;
  }
public static function processPasswordUpdate ( & $ element , FormStateInterface $ form_state , & $ complete_form ) { $ element [ 'oldpass' ] = [ '#type' => 'password' , '#title' => t ( 'Old Password' ) , '#value' => empty ( $ element [ '#value' ] ) ? NULL : $ element [ '#value' ] [ 'oldpass' ] , '#required' => $ element [ '#required' ] , '#error_no_message' => TRUE , ] ; $ element [ 'pass1' ] = [ '#type' => 'password' , '#title' => t ( 'Password' ) , '#value' => empty ( $ element [ '#value' ] ) ? NULL : $ element [ '#value' ] [ 'pass1' ] , '#required' => $ element [ '#required' ] , '#attributes' => [ 'class' => [ 'password-field' , 'js-password-field' ] ] , '#error_no_message' => TRUE , ] ; $ element [ 'pass2' ] = [ '#type' => 'password' , '#title' => t ( 'Confirm password' ) , '#value' => empty ( $ element [ '#value' ] ) ? NULL : $ element [ '#value' ] [ 'pass2' ] , '#required' => $ element [ '#required' ] , '#attributes' => [ 'class' => [ 'password-confirm' , 'js-password-confirm' ] ] , '#error_no_message' => TRUE , ] ; $ element [ '#element_validate' ] = [ [ get_called_class ( ) , 'validatePasswordUpdate' ] ] ; $ element [ '#tree' ] = TRUE ; if ( isset ( $ element [ '#size' ] ) ) { $ element [ 'pass1' ] [ '#size' ] = $ element [ 'pass2' ] [ '#size' ] + $ element [ 'oldpass' ] [ '#size' ] = $ element [ '#size' ] ; } return $ element ; }
Expand an acm_password_update field into three text boxes.
Expand an acm_password_update field into three text boxes .