You are here

class ConfigPartialExportController in Config Partial Export 8

Returns responses for config module routes.

Hierarchy

Expanded class hierarchy of ConfigPartialExportController

File

src/Controller/ConfigPartialExportController.php, line 13

Namespace

Drupal\config_partial_export\Controller
View source
class ConfigPartialExportController implements ContainerInjectionInterface {

  /**
   * The file download controller.
   *
   * @var \Drupal\system\FileDownloadController
   */
  protected $fileDownloadController;

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(new FileDownloadController(\Drupal::service('stream_wrapper_manager')));
  }

  /**
   * Constructs a ConfigController object.
   *
   * @param \Drupal\system\FileDownloadController $file_download_controller
   *   The file download controller.
   */
  public function __construct(FileDownloadController $file_download_controller) {
    $this->fileDownloadController = $file_download_controller;
  }

  /**
   * Downloads a tarball of the site configuration.
   */
  public function downloadExport() {
    $request = new Request([
      'file' => 'config_partial.tar.gz',
    ]);
    $result = $this->fileDownloadController
      ->download($request, 'temporary');
    return $result;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigPartialExportController::$fileDownloadController protected property The file download controller.
ConfigPartialExportController::create public static function Instantiates a new instance of this class. Overrides ContainerInjectionInterface::create
ConfigPartialExportController::downloadExport public function Downloads a tarball of the site configuration.
ConfigPartialExportController::__construct public function Constructs a ConfigController object.