You are here

public function YamlWebformExporter::writeSubmission in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformExporter/YamlWebformExporter.php \Drupal\webform\Plugin\WebformExporter\YamlWebformExporter::writeSubmission()

Write submission to export.

Parameters

\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.

Overrides WebformExporterBase::writeSubmission

File

src/Plugin/WebformExporter/YamlWebformExporter.php, line 24

Class

YamlWebformExporter
Defines a YAML document exporter.

Namespace

Drupal\webform\Plugin\WebformExporter

Code

public function writeSubmission(WebformSubmissionInterface $webform_submission) {
  $file_name = $this
    ->getSubmissionBaseName($webform_submission) . '.yml';
  $yaml = WebformYaml::encode($webform_submission
    ->toArray(TRUE, TRUE));
  $this
    ->addToArchive($yaml, $file_name);
}