You are here

public function SubscriberExportForm::submitForm in Simplenews 3.x

Same name and namespace in other branches
  1. 8.2 src/Form/SubscriberExportForm.php \Drupal\simplenews\Form\SubscriberExportForm::submitForm()
  2. 8 src/Form/SubscriberExportForm.php \Drupal\simplenews\Form\SubscriberExportForm::submitForm()

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/SubscriberExportForm.php, line 131

Class

SubscriberExportForm
Do a mass subscription for a list of email addresses.

Namespace

Drupal\simplenews\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $form_values = $form_state
    ->getValues();

  // Get data for query string and redirect back to the current page.
  $options['query']['states'] = array_filter($form_values['states']);
  $options['query']['subscribed'] = array_filter($form_values['subscribed']);
  $options['query']['newsletters'] = array_keys(array_filter($form_values['newsletters']));
  $form_state
    ->setRedirect('simplenews.subscriber_export', [], $options);
}