You are here

public function WebformSubmissionsDeleteFormBase::batchSet in Webform 6.x

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

Batch API; Initialize batch operations.

Parameters

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

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

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

File

src/Form/WebformSubmissionsDeleteFormBase.php, line 133

Class

WebformSubmissionsDeleteFormBase
Base webform for deleting webform submission.

Namespace

Drupal\webform\Form

Code

public function batchSet(WebformInterface $webform = NULL, EntityInterface $entity = NULL) {
  $parameters = [
    $webform,
    $entity,
    $this
      ->getSubmissionStorage()
      ->getMaxSubmissionId($webform, $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);
}