You are here

protected function YamlFormElementBase::prefixExportHeader in YAML Form 8

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.

3 calls to YamlFormElementBase::prefixExportHeader()
OptionsBase::buildExportHeader in src/Plugin/YamlFormElement/OptionsBase.php
Build an element's export header.
YamlFormCompositeBase::buildExportHeader in src/Plugin/YamlFormElement/YamlFormCompositeBase.php
Build an element's export header.
YamlFormLikert::buildExportHeader in src/Plugin/YamlFormElement/YamlFormLikert.php
Build an element's export header.

File

src/YamlFormElementBase.php, line 753

Class

YamlFormElementBase
Provides a base class for a form element.

Namespace

Drupal\yamlform

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;
}