You are here

public function WebformMapping::buildExportRecord in Webform 8.5

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

Build an element's export row.

Parameters

array $element: An element.

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

array $export_options: An associative array of export options.

Return value

array An array containing the element's export row.

Overrides WebformElementBase::buildExportRecord

See also

\Drupal\webform\WebformSubmissionExporterInterface::getDefaultExportOptions

File

src/Plugin/WebformElement/WebformMapping.php, line 255

Class

WebformMapping
Provides a 'mapping' element.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function buildExportRecord(array $element, WebformSubmissionInterface $webform_submission, array $export_options) {
  $value = $this
    ->getValue($element, $webform_submission);
  $record = [];
  foreach ($element['#source'] as $source_key => $source_title) {
    $record[] = isset($value[$source_key]) ? $value[$source_key] : NULL;
  }
  return $record;
}