You are here

public function YamlFormSubmissionExporter::getDefaultExportOptions in YAML Form 8

Get default export options.

Return value

array Default export options.

Overrides YamlFormSubmissionExporterInterface::getDefaultExportOptions

3 calls to YamlFormSubmissionExporter::getDefaultExportOptions()
YamlFormSubmissionExporter::buildExportOptionsForm in src/YamlFormSubmissionExporter.php
Build export options form.
YamlFormSubmissionExporter::getValuesFromInput in src/YamlFormSubmissionExporter.php
Get the values from the form's user input or form state values.
YamlFormSubmissionExporter::setExporter in src/YamlFormSubmissionExporter.php
Set results exporter.

File

src/YamlFormSubmissionExporter.php, line 227

Class

YamlFormSubmissionExporter
Form submission exporter.

Namespace

Drupal\yamlform

Code

public function getDefaultExportOptions() {
  if (isset($this->defaultOptions)) {
    return $this->defaultOptions;
  }
  $this->defaultOptions = [
    'exporter' => 'delimited',
    'delimiter' => ',',
    'file_name' => 'submission-[yamlform_submission:serial]',
    'header_format' => 'label',
    'header_prefix' => TRUE,
    'header_prefix_label_delimiter' => ': ',
    'header_prefix_key_delimiter' => '__',
    'excluded_columns' => [
      'uuid' => 'uuid',
      'token' => 'token',
      'yamlform_id' => 'yamlform_id',
    ],
    'entity_type' => '',
    'entity_id' => '',
    'range_type' => 'all',
    'range_latest' => '',
    'range_start' => '',
    'range_end' => '',
    'state' => 'all',
    'sticky' => '',
    'download' => TRUE,
    'files' => FALSE,
  ];

  // Append element handler default options.
  $element_types = $this
    ->getYamlFormElementTypes();
  $element_handlers = $this->elementManager
    ->getInstances();
  foreach ($element_handlers as $element_type => $element_handler) {
    if (empty($element_types) || isset($element_types[$element_type])) {
      $this->defaultOptions += $element_handler
        ->getExportDefaultOptions();
    }
  }
  return $this->defaultOptions;
}