You are here

private function ManageFilesForm::operations in Minify JS 8.2

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

Helper function to return the operations available for the file.

Parameters

object $file: The file to generate operations for.

Return value

array The list of operations.

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

File

src/Form/ManageFilesForm.php, line 388

Class

ManageFilesForm
Manage files form class.

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;
}