function minifyjs_batch_minify_file_operation in Minify JS 8
Same name and namespace in other branches
- 8.2 minifyjs.module \minifyjs_batch_minify_file_operation()
Helper function for batch, minify file operation.
Parameters
int $fid:
array $context:
1 string reference to 'minifyjs_batch_minify_file_operation'
- ManageFilesForm::submitForm in src/
Form/ ManageFilesForm.php - Form submission handler.
File
- ./
minifyjs.module, line 310
Code
function minifyjs_batch_minify_file_operation($fid, &$context) {
// Set the context message
$files = minifyjs_load_all_files();
$file = $files[$fid];
$context['message'] = t('Minifying file - %file', [
'%file' => $file->uri,
]);
// Perform the minify
$result = minifyjs_minify_file($fid);
if ($result === TRUE) {
$context['results']['success'][] = t('File %file was minified successfully.', [
'%file' => $file->uri,
]);
}
else {
$context['results']['errors'][] = $result;
}
}