You are here

public static function AuditFilesBatchProcess::finishBatch in Audit Files 8.3

Same name and namespace in other branches
  1. 4.x src/Batch/AuditFilesBatchProcess.php \Drupal\auditfiles\Batch\AuditFilesBatchProcess::finishBatch()

Messenger Factor Service called when the batch is completed.

@todo Refactor into a factory worker process class.

File

src/Batch/AuditFilesBatchProcess.php, line 17

Class

AuditFilesBatchProcess
Process batch process completion messages.

Namespace

Drupal\auditfiles\Batch

Code

public static function finishBatch($success, $results, $operations) {
  $messenger = \Drupal::service('messenger');
  if (!$success) {
    $error_operation = reset($operations);
    $messenger
      ->addError(new TranslatableMarkup('An error occurred while processing @operation with arguments : @args', [
      '@operation' => $error_operation[0],
      '@args' => print_r($error_operation[0], TRUE),
    ]));
  }
}