You are here

function noreqnewpass_form_alter in No Request New Password 8

Same name and namespace in other branches
  1. 5 noreqnewpass.module \noreqnewpass_form_alter()
  2. 6 noreqnewpass.module \noreqnewpass_form_alter()
  3. 7.2 noreqnewpass.module \noreqnewpass_form_alter()
  4. 7 noreqnewpass.module \noreqnewpass_form_alter()

Implements hook_form_alter().

File

./noreqnewpass.module, line 13
Contains noreqnewpass.module.

Code

function noreqnewpass_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  if ($form_id == 'user_login_block' || $form_id == 'user_login_form') {

    // Retrieve the configuration.
    $config = \Drupal::config('noreqnewpass.settings_form');
    if ($config
      ->get('noreqnewpass_disable')) {
      $key = array_search('::validateFinal', $form['#validate']);
      $form['#validate'][$key] = 'noreqnewpass_user_login_final_validate';
    }
  }
}