You are here

public function ContentImport::submitForm in Content Import 8.9

Same name and namespace in other branches
  1. 8 src/Form/ContentImport.php \Drupal\contentimport\Form\ContentImport::submitForm()
  2. 8.3 src/Form/ContentImport.php \Drupal\contentimport\Form\ContentImport::submitForm()
  3. 8.4 src/Form/ContentImport.php \Drupal\contentimport\Form\ContentImport::submitForm()

Content Import Form Submission.

Overrides ConfigFormBase::submitForm

File

src/Form/ContentImport.php, line 141

Class

ContentImport
Configure Content Import settings for this site.

Namespace

Drupal\contentimport\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $content_type = $form_state
    ->getValue('contentimport_contenttype');
  $import_type = $form_state
    ->getValue('contentimport_importtype');

  // import_node($this->file, $content_type, $import_type);.
  $batch = [
    'title' => $this
      ->t('Importing Content'),
    'operations' => [
      [
        'import_node',
        [
          $this->file,
          $content_type,
          $import_type,
        ],
      ],
    ],
    'init_message' => $this
      ->t('Importing...please wait'),
    'progress_message' => $this
      ->t('Processed @current out of @total.'),
    'finished' => 'import_success',
  ];
  batch_set($batch);
}