You are here

public function ContactStorageExportForm::submitForm in Contact Storage Export 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/ContactStorageExportForm.php, line 224

Class

ContactStorageExportForm
Settings form for config devel.

Namespace

Drupal\contact_storage_export\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Path to the batch processing.
  $path = drupal_get_path('module', 'contact_storage_export');
  $path .= '/src/ContactStorageExportBatches.php';

  // Information to pass to the batch processing.
  $settings = $form_state
    ->getValues();
  $settings['columns'] = array_filter($settings['columns']);
  $batch = [
    'title' => t('Exporting'),
    'operations' => [
      [
        '_contact_storage_export_process_batch',
        [
          $settings,
        ],
      ],
    ],
    'finished' => '_contact_storage_export_finish_batch',
    'file' => $path,
  ];
  batch_set($batch);
}