function minifyjs_batch_finished in Minify JS 8.2
Same name and namespace in other branches
- 8 minifyjs.module \minifyjs_batch_finished()
- 7 minifyjs.admin.inc \minifyjs_batch_finished()
Batch - finished.
Parameters
bool $success: Batch finished successfully or not.
array $results: The results of the batch.
array $operations: The operations remaining to run (only present if there was an error).
1 string reference to 'minifyjs_batch_finished'
- ManageFilesForm::submitForm in src/
Form/ ManageFilesForm.php - Form submission handler.
File
- ./
minifyjs.module, line 186 - Hooks and functions for the minifyjs module.
Code
function minifyjs_batch_finished($success, array $results, array $operations) {
// Output successful operations.
if (isset($results['success'])) {
if ($results['operation'] == 'minify') {
\Drupal::messenger()
->addMessage(t('%count files were minified.', [
'%count' => $results['success'],
]));
}
if ($results['operation'] == 'restore') {
\Drupal::messenger()
->addMessage(t('%count files were restored.', [
'%count' => $results['success'],
]));
}
}
// Output errors.
if (isset($results['errors'])) {
if (count($results['errors'])) {
foreach ($results['errors'] as $error) {
\Drupal::messenger()
->addMessage($error, 'error');
}
}
}
// Clear the cache so this change will be reflected in
// \Drupal::service('minifyjs')->loadAllFiles().
\Drupal::cache()
->delete(MINIFYJS_CACHE_CID);
}