You are here

public static function WebformSubmissionExportImportUploadForm::batchSet in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_submission_export_import/src/Form/WebformSubmissionExportImportUploadForm.php \Drupal\webform_submission_export_import\Form\WebformSubmissionExportImportUploadForm::batchSet()

Batch API; Initialize batch operations.

Parameters

\Drupal\webform\WebformInterface|null $webform: A webform.

\Drupal\Core\Entity\EntityInterface|null $source_entity: A webform source entity.

string $import_uri: The URI of the CSV import file.

array $import_options: An array of import options.

See also

http://www.jeffgeerling.com/blogs/jeff-geerling/using-batch-api-build-hu...

2 calls to WebformSubmissionExportImportUploadForm::batchSet()
WebformCliService::drush_webform_import in src/Commands/WebformCliService.php
WebformSubmissionExportImportUploadForm::submitImportForm in modules/webform_submission_export_import/src/Form/WebformSubmissionExportImportUploadForm.php
Import submission handler.

File

modules/webform_submission_export_import/src/Form/WebformSubmissionExportImportUploadForm.php, line 541

Class

WebformSubmissionExportImportUploadForm
Upload webform submission export import CSV.

Namespace

Drupal\webform_submission_export_import\Form

Code

public static function batchSet(WebformInterface $webform, EntityInterface $source_entity = NULL, $import_uri = '', array $import_options = []) {
  $parameters = [
    $webform,
    $source_entity,
    $import_uri,
    $import_options,
  ];
  $batch = [
    'title' => t('Importing submissions'),
    'init_message' => t('Initializing submission import'),
    'error_message' => t('The import could not be completed because an error occurred.'),
    'operations' => [
      [
        [
          '\\Drupal\\webform_submission_export_import\\Form\\WebformSubmissionExportImportUploadForm',
          'batchProcess',
        ],
        $parameters,
      ],
    ],
    'finished' => [
      '\\Drupal\\webform_submission_export_import\\Form\\WebformSubmissionExportImportUploadForm',
      'batchFinish',
    ],
  ];
  batch_set($batch);
}