public function MultipleNidsExportForm::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/ MultipleNidsExportForm.php, line 62
Class
- MultipleNidsExportForm
- Provides a Multiple Node Export form using Nids.
Namespace
Drupal\node_Export\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$nid = $form_state
->getValue('nids');
$nids = [];
$nids = explode("\n", $nid);
$batch = [
'title' => $this
->t('Exporting Nodes...'),
'operations' => [],
'init_message' => $this
->t('Commencing'),
'progress_message' => $this
->t('Processed @current out of @total.'),
'error_message' => $this
->t('An error occurred during processing'),
'finished' => '\\Drupal\\node_export\\NodeExport::nodeExportFinishedCallback',
];
foreach ($nids as $nid) {
$nidt = trim($nid);
$batch['operations'][] = [
'\\Drupal\\node_export\\NodeExport::nodeExport',
[
$nidt,
],
];
}
batch_set($batch);
$this
->messenger()
->addStatus($this
->t('The File with export code has been saved in your public directory'));
}