You are here

function minifyjs_batch_remove_minified_file_operation in Minify JS 8

Same name and namespace in other branches
  1. 8.2 minifyjs.module \minifyjs_batch_remove_minified_file_operation()

Helper function for batch, remove minified file operation.

Parameters

int $fid:

array $context:

1 string reference to 'minifyjs_batch_remove_minified_file_operation'
ManageFilesForm::submitForm in src/Form/ManageFilesForm.php
Form submission handler.

File

./minifyjs.module, line 333

Code

function minifyjs_batch_remove_minified_file_operation($fid, &$context) {

  // Set the context message
  $files = minifyjs_load_all_files();
  $file = $files[$fid];
  $context['message'] = t('Restoring un-minified file - %file', [
    '%file' => $file->uri,
  ]);

  // Perform the restore
  $result = minifyjs_remove_minified_file($fid);
  if ($result === TRUE) {
    $context['results']['success'][] = t('File %file was restored successfully.', [
      '%file' => $file->uri,
    ]);
  }
  else {
    $context['results']['errors'][] = $result;
  }
}