You are here

public function YamlFormSubmissionsDeleteFormBase::batchSet in YAML Form 8

Batch API; Initialize batch operations.

Parameters

\Drupal\yamlform\YamlFormInterface|null $yamlform: The form.

\Drupal\Core\Entity\EntityInterface|null $entity: The form's source entity.

1 call to YamlFormSubmissionsDeleteFormBase::batchSet()
YamlFormSubmissionsDeleteFormBase::submitForm in src/Form/YamlFormSubmissionsDeleteFormBase.php
Form submission handler.

File

src/Form/YamlFormSubmissionsDeleteFormBase.php, line 123

Class

YamlFormSubmissionsDeleteFormBase
Base form for deleting form submission.

Namespace

Drupal\yamlform\Form

Code

public function batchSet(YamlFormInterface $yamlform = NULL, EntityInterface $entity = NULL) {
  $parameters = [
    $yamlform,
    $entity,
    $this->submissionStorage
      ->getMaxSubmissionId($yamlform, $entity),
  ];
  $batch = [
    'title' => $this
      ->t('Clear submissions'),
    'init_message' => $this
      ->t('Clearing submission data'),
    'error_message' => $this
      ->t('The submissions could not be cleared because an error occurred.'),
    'operations' => [
      [
        [
          $this,
          'batchProcess',
        ],
        $parameters,
      ],
    ],
    'finished' => [
      $this,
      'batchFinish',
    ],
  ];
  batch_set($batch);
}