public function JsonYamlFormExporter::writeSubmission in YAML Form 8
Write submission to export.
Parameters
\Drupal\yamlform\YamlFormSubmissionInterface $yamlform_submission: A form submission.
Overrides YamlFormExporterBase::writeSubmission
File
- src/
Plugin/ YamlFormExporter/ JsonYamlFormExporter.php, line 25
Class
- JsonYamlFormExporter
- Defines a JSON document exporter.
Namespace
Drupal\yamlform\Plugin\YamlFormExporterCode
public function writeSubmission(YamlFormSubmissionInterface $yamlform_submission) {
$file_name = $this
->getSubmissionBaseName($yamlform_submission) . '.json';
$json = Json::encode($yamlform_submission
->toArray(TRUE));
$archiver = new ArchiveTar($this
->getArchiveFilePath(), 'gz');
$archiver
->addString($file_name, $json);
}