You are here

private function ManageFilesForm::operations in Minify JS 8

Same name and namespace in other branches
  1. 8.2 src/Form/ManageFilesForm.php \Drupal\minifyjs\Form\ManageFilesForm::operations()

Helper function to return the operations available for the file.

Parameters

stdClass $file:

1 call to ManageFilesForm::operations()
ManageFilesForm::buildForm in src/Form/ManageFilesForm.php
Form constructor.

File

src/Form/ManageFilesForm.php, line 360

Class

ManageFilesForm
Displays a list of detected javascript files and allows actions to be performed on them

Namespace

Drupal\minifyjs\Form

Code

private function operations($file) {
  $operations = [];
  if (empty($file->minified_uri)) {
    $operations['minify'] = [
      'title' => t('Minify'),
      'url' => Url::fromUri('base:/admin/config/development/performance/js/' . $file->fid . '/minify'),
    ];
  }
  else {
    $operations['reminify'] = [
      'title' => t('Re-Minify'),
      'url' => Url::fromUri('base:/admin/config/development/performance/js/' . $file->fid . '/minify'),
    ];
    $operations['restore'] = [
      'title' => t('Restore'),
      'url' => Url::fromUri('base:/admin/config/development/performance/js/' . $file->fid . '/restore'),
    ];
  }
  return $operations;
}