You are here

public function TableWebformExporter::writeSubmission in Webform 6.x

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

Write submission to export.

Parameters

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

Overrides WebformExporterBase::writeSubmission

File

src/Plugin/WebformExporter/TableWebformExporter.php, line 89

Class

TableWebformExporter
Defines a HTML table exporter.

Namespace

Drupal\webform\Plugin\WebformExporter

Code

public function writeSubmission(WebformSubmissionInterface $webform_submission) {
  $record = $this
    ->buildRecord($webform_submission);
  $file_handle = $this->fileHandle;
  $row = [];
  foreach ($record as $item) {
    $row[] = '<td>' . nl2br(htmlentities($item)) . '</td>';
  }
  fwrite($file_handle, '<tr valign="top">');
  fwrite($file_handle, implode(PHP_EOL, $row));
  fwrite($file_handle, '</tr>');
}