You are here

function _recovery_pass_insert_array in Recovery Password (Email New Password) 7

Same name and namespace in other branches
  1. 8 recovery_pass.module \_recovery_pass_insert_array()

To insert our validator at index 1 between the default validators.

1 call to _recovery_pass_insert_array()
recovery_pass_form_alter in ./recovery_pass.module
Implements hook_form_alter().

File

./recovery_pass.module, line 201
Alters default Drupal password recovery process by overriding default submit.

Code

function _recovery_pass_insert_array($array, $index, $val) {

  // Because this will be used one more time.
  $size = count($array);
  if (!is_int($index) || $index < 0 || $index > $size) {
    return -1;
  }
  else {
    $temp = array_slice($array, 0, $index);
    $temp[] = $val;
    return array_merge($temp, array_slice($array, $index, $size));
  }
}