You are here

public function AcquiadamConfig::finishBatchOperation in Media: Acquia DAM 8

Finish callback for the batch operation.

Parameters

bool $success: The Success flag.

array $results: Results.

array $operations: Operations.

File

src/Form/AcquiadamConfig.php, line 325

Class

AcquiadamConfig
Class AcquiadamConfig.

Namespace

Drupal\media_acquiadam\Form

Code

public function finishBatchOperation($success, array $results, array $operations) {
  $message = $this
    ->getStringTranslation()
    ->formatPlural($results['processed'], '1 asset (out of @total) has been synchronized.', '@count assets (out of @total) have been synchronized.', [
    '@total' => $results['total'],
  ]);
  $this
    ->messenger()
    ->addStatus($message);
  if ($results['processed'] === $results['total']) {

    // Reset all Drupal States related to the automatic asset synchronization.
    $this->state
      ->set('media_acquiadam.notifications_starttime', $results['start_time']);
    $this->state
      ->set('media_acquiadam.notifications_endtime', NULL);
    $this->state
      ->set('media_acquiadam.notifications_next_page', NULL);
  }
}