public static function PriceListItemImportForm::finishBatch in Commerce Pricelist 8.2
Batch finished callback: display batch statistics.
Parameters
bool $success: Indicates whether the batch has completed successfully.
mixed[] $results: The array of results gathered by the batch processing.
string[] $operations: If $success is FALSE, contains the operations that remained unprocessed.
File
- src/
Form/ PriceListItemImportForm.php, line 449
Class
Namespace
Drupal\commerce_pricelist\FormCode
public static function finishBatch($success, array $results, array $operations) {
if (!$success) {
$error_operation = reset($operations);
\Drupal::messenger()
->addError(t('An error occurred while processing @operation with arguments: @args', [
'@operation' => $error_operation[0],
'@args' => (string) print_r($error_operation[0], TRUE),
]));
return;
}
if (!empty($results['error'])) {
\Drupal::messenger()
->addError($results['error_message']);
}
else {
if (!empty($results['import_created'])) {
\Drupal::messenger()
->addMessage(\Drupal::translation()
->formatPlural($results['import_created'], 'Imported 1 price.', 'Imported @count prices.'));
}
if (!empty($results['import_updated'])) {
\Drupal::messenger()
->addMessage(\Drupal::translation()
->formatPlural($results['import_updated'], 'Updated 1 price.', 'Updated @count prices.'));
}
if (!empty($results['import_skipped'])) {
\Drupal::messenger()
->addWarning(\Drupal::translation()
->formatPlural($results['import_skipped'], 'Skipped 1 price during import.', 'Skipped @count prices during import.'));
}
}
}