You are here

public function BulkNodeExport::submitForm in Node 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/BulkNodeExport.php, line 122

Class

BulkNodeExport
Provides a Node Export form.

Namespace

Drupal\node_Export\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $data = $form_state
    ->getValue('export_code');
  header('Content-Type: application/octet-stream');
  header('Content-Disposition: attachment; filename=' . basename('node.json'));
  header('Expires: 0');
  header('Cache-Control: must-revalidate');
  header('Pragma: public');
  header('Content-Length: ' . filesize('node.json'));
  print $data;
  exit;
}