protected function TabularBaseYamlFormExporter::buildHeader in YAML Form 8
Build export header using form submission field definitions and form element columns.
Return value
array An array containing the export header.
2 calls to TabularBaseYamlFormExporter::buildHeader()
- DelimitedYamlFormExporter::writeHeader in src/
Plugin/ YamlFormExporter/ DelimitedYamlFormExporter.php - Write header to export.
- TableYamlFormExporter::writeHeader in src/
Plugin/ YamlFormExporter/ TableYamlFormExporter.php - Write header to export.
File
- src/
Plugin/ YamlFormExporter/ TabularBaseYamlFormExporter.php, line 39
Class
- TabularBaseYamlFormExporter
- Defines abstract tabular exporter used to build CSV files and HTML tables.
Namespace
Drupal\yamlform\Plugin\YamlFormExporterCode
protected function buildHeader() {
$export_options = $this
->getConfiguration();
$this->fieldDefinitions = $this
->getFieldDefinitions();
$elements = $this
->getElements();
$header = [];
foreach ($this->fieldDefinitions as $field_definition) {
// Build a form element for each field definition so that we can
// use YamlFormElement::buildExportHeader(array $element, $export_options).
$element = [
'#type' => $field_definition['type'] == 'entity_reference' ? 'entity_autocomplete' : 'element',
'#admin_title' => '',
'#title' => (string) $field_definition['title'],
'#yamlform_key' => (string) $field_definition['name'],
];
$header = array_merge($header, $this->elementManager
->invokeMethod('buildExportHeader', $element, $export_options));
}
// Build element columns headers.
foreach ($elements as $element) {
$header = array_merge($header, $this->elementManager
->invokeMethod('buildExportHeader', $element, $export_options));
}
return $header;
}