You are here

FileManager.php in Minify JS 8.2

Same filename and directory in other branches
  1. 8 src/Controller/FileManager.php

File

src/Controller/FileManager.php
View source
<?php

namespace Drupal\minifyjs\Controller;

use Drupal\Core\Controller\ControllerBase;

/**
 * Controller routines for minifyjs routes.
 */
class FileManager extends ControllerBase {

  /**
   * Minify a single file.
   *
   * @param object $file
   *   The file to minify.
   *
   * @return \Symfony\Component\HttpFoundation\RedirectResponse
   *   Returns a redirect to the manage javascript page.
   */
  public function minify($file) {
    \Drupal::service('minifyjs')
      ->minify($file);
    return $this
      ->redirect('minifyjs.manage');
  }

  /**
   * Remove the minified version of a single file (restore it).
   *
   * @param object $file
   *   The file to restore.
   *
   * @return \Symfony\Component\HttpFoundation\RedirectResponse
   *   Returns a redirect to the manage javascript page.
   */
  public function restore($file) {
    \Drupal::service('minifyjs')
      ->restore($file);
    return $this
      ->redirect('minifyjs.manage');
  }

  /**
   * Scans the system for javascript.
   *
   * @return \Symfony\Component\HttpFoundation\RedirectResponse
   *   Returns a redirect to the manage javascript page.
   */
  public function scan() {
    \Drupal::service('minifyjs')
      ->scan();
    return $this
      ->redirect('minifyjs.manage');
  }

}

Classes

Namesort descending Description
FileManager Controller routines for minifyjs routes.