You are here

protected function WebformElementBase::prefixExportHeader in Webform 8.5

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

Prefix an element's export header.

Parameters

array $header: An element's export header.

array $element: An element.

array $export_options: An associative array of export options.

Return value

array An element's export header with prefix.

4 calls to WebformElementBase::prefixExportHeader()
OptionsBase::buildExportHeader in src/Plugin/WebformElement/OptionsBase.php
Build an element's export header.
WebformCompositeBase::buildExportHeader in src/Plugin/WebformElement/WebformCompositeBase.php
Build an element's export header.
WebformLikert::buildExportHeader in src/Plugin/WebformElement/WebformLikert.php
Build an element's export header.
WebformMapping::buildExportHeader in src/Plugin/WebformElement/WebformMapping.php
Build an element's export header.

File

src/Plugin/WebformElementBase.php, line 1974

Class

WebformElementBase
Provides a base class for a webform element.

Namespace

Drupal\webform\Plugin

Code

protected function prefixExportHeader(array $header, array $element, array $export_options) {
  if (empty($export_options['header_prefix'])) {
    return $header;
  }
  if ($export_options['header_format'] === 'label') {
    $prefix = $this
      ->getAdminLabel($element) . $export_options['header_prefix_label_delimiter'];
  }
  else {
    $prefix = $this
      ->getKey($element) . $export_options['header_prefix_key_delimiter'];
  }
  foreach ($header as $index => $column) {
    $header[$index] = $prefix . $column;
  }
  return $header;
}