You are here

public function YamlFormLikert::buildExportHeader in YAML Form 8

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 YamlFormElementBase::buildExportHeader

See also

\Drupal\yamlform\YamlFormSubmissionExporterInterface::getDefaultExportOptions

File

src/Plugin/YamlFormElement/YamlFormLikert.php, line 222

Class

YamlFormLikert
Provides a 'likert' element.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

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