You are here

public function ImporterBase::finished in CSV Importer 8

Batch finish handler.

Parameters

bool $success: A boolean indicating whether the batch has completed successfully.

array $results: The value set in $context['results'] by callback_batch_operation().

array $operations: Contains the operations that remained unprocessed.

Return value

array Prepared data.

Overrides ImporterInterface::finished

File

src/Plugin/ImporterBase.php, line 178

Class

ImporterBase
Provides a base class for ImporterBase plugins.

Namespace

Drupal\csv_importer\Plugin

Code

public function finished($success, array $results, array $operations) {
  $message = '';
  if ($success) {
    $message = $this
      ->t('@count_added content added and @count_updated updated', [
      '@count_added' => isset($results['added']) ? count($results['added']) : 0,
      '@count_updated' => isset($results['updated']) ? count($results['updated']) : 0,
    ]);
  }
  $this
    ->messenger()
    ->addMessage($message);
}