public static function ConfigForm::finishBatch in Flysystem 3.x
Same name and namespace in other branches
- 8 src/Form/ConfigForm.php \Drupal\flysystem\Form\ConfigForm::finishBatch()
- 2.0.x src/Form/ConfigForm.php \Drupal\flysystem\Form\ConfigForm::finishBatch()
- 3.0.x src/Form/ConfigForm.php \Drupal\flysystem\Form\ConfigForm::finishBatch()
Finish batch.
1 call to ConfigForm::finishBatch()
- ConfigFormTest::testFinishBatch in tests/
src/ Unit/ Form/ ConfigFormTest.php - @covers ::finishBatch
File
- src/
Form/ ConfigForm.php, line 185
Class
- ConfigForm
- Configure file system settings for this site.
Namespace
Drupal\flysystem\FormCode
public static function finishBatch($success, array $results, array $operations) {
$messenger = \Drupal::messenger();
if (!$success) {
// An error occurred.
// $operations contains the operations that remained unprocessed.
$args = [
'%file' => reset($operations)[2],
];
$messenger
->addError(\Drupal::translation()
->translate('An error occurred while syncing: %file', $args));
return;
}
if (empty($results['errors'])) {
$messenger
->addStatus(\Drupal::translation()
->translate('File synchronization finished successfully.'));
return;
}
foreach ($results['errors'] as $error) {
if (is_array($error)) {
$messenger
->addError(\Drupal::translation()
->translate($error[0], $error[1]), TRUE);
\Drupal::logger('flysystem')
->error($error[0], $error[1]);
}
else {
$messenger
->addError(Html::escape($error), TRUE);
}
}
$messenger
->addWarning(\Drupal::translation()
->translate('File synchronization experienced errors.'));
}