You are here

public function WebformSubmissionExporter::getValuesFromInput in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/WebformSubmissionExporter.php \Drupal\webform\WebformSubmissionExporter::getValuesFromInput()

Get the values from the webform's user input or webform state values.

Parameters

array $values: An associative array of user input or webform state values.

Return value

array An associative array of export options.

Overrides WebformSubmissionExporterInterface::getValuesFromInput

File

src/WebformSubmissionExporter.php, line 740

Class

WebformSubmissionExporter
Webform submission exporter.

Namespace

Drupal\webform

Code

public function getValuesFromInput(array $values) {

  // Get selected exporter configuration.
  if (isset($values['exporter']) && isset($values['exporters'])) {
    if (isset($values['exporters'][$values['exporter']])) {
      $values += $values['exporters'][$values['exporter']];
    }
    unset($values['exporters']);
  }
  if (isset($values['range_type'])) {
    $range_type = $values['range_type'];
    $values['range_type'] = $range_type;
    if (isset($values[$range_type])) {
      $values += $values[$range_type];
    }
  }

  // Make sure only support options are returned.
  $values = array_intersect_key($values, $this
    ->getDefaultExportOptions());
  return $values;
}