You are here

public function WebformExporterBase::addToArchive in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/WebformExporterBase.php \Drupal\webform\Plugin\WebformExporterBase::addToArchive()

Add file, directory, or content to exporter archive.

Parameters

string $path: System path or file content.

string $name: Archive path or file name (applies to file content).

array $options: Tar and zip options.

Overrides WebformExporterInterface::addToArchive

3 calls to WebformExporterBase::addToArchive()
JsonWebformExporter::writeSubmission in src/Plugin/WebformExporter/JsonWebformExporter.php
Write submission to export.
WebformEntityPrintWebformExporter::writeSubmission in modules/webform_entity_print/src/Plugin/WebformExporter/WebformEntityPrintWebformExporter.php
Write submission to export.
YamlWebformExporter::writeSubmission in src/Plugin/WebformExporter/YamlWebformExporter.php
Write submission to export.

File

src/Plugin/WebformExporterBase.php, line 355

Class

WebformExporterBase
Provides a base class for a results exporter.

Namespace

Drupal\webform\Plugin

Code

public function addToArchive($path, $name, array $options = []) {
  $options += [
    'remove_path' => '',
    'close' => FALSE,
  ];
  if ($this
    ->getArchiveType() === WebformExporterInterface::ARCHIVE_ZIP) {
    $this
      ->addToZipFile($path, $name, $options);
  }
  else {
    $this
      ->addToTarArchive($path, $name, $options);
  }
}