You are here

public function WebformMapping::buildExportHeader in Webform 8.5

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

Build an element's export header.

Parameters

array $element: An element.

array $options: An associative array of export options.

Return value

array An array containing the element's export headers.

Overrides WebformElementBase::buildExportHeader

See also

\Drupal\webform\WebformSubmissionExporterInterface::getDefaultExportOptions

File

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

Class

WebformMapping
Provides a 'mapping' element.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function buildExportHeader(array $element, array $options) {
  $header = [];
  foreach ($element['#source'] as $key => $label) {
    $header[] = $options['header_format'] === 'key' ? $key : $label;
  }
  return $this
    ->prefixExportHeader($header, $element, $options);
}