public function MassPasswordResetConfirm::submitForm in Mass Password Change 8
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- src/
Form/ MassPasswordResetConfirm.php, line 115  
Class
- MassPasswordResetConfirm
 - Provides a confirmation form for mass password reset action.
 
Namespace
Drupal\mass_password_change\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
  // Clear out the accounts from the temp store.
  $this->tempStoreFactory
    ->get('mass_password_change')
    ->delete('mass_password_change');
  if ($form_state
    ->getValue('confirm')) {
    foreach ($form_state
      ->getValue('accounts') as $uid) {
      /* @var \Drupal\user\Entity\User $account */
      $account = $this->userStorage
        ->load($uid);
      _user_mail_notify('password_reset', $account);
    }
  }
  $form_state
    ->setRedirect('entity.user.collection');
}