You are here

public function YamlFormSubmissionGenerate::getData in YAML Form 8

Generate form submission data.

Parameters

\Drupal\yamlform\YamlFormInterface $yamlform: The form this submission will be added to.

Return value

array An associative array containing form submission data.

Overrides YamlFormSubmissionGenerateInterface::getData

File

src/YamlFormSubmissionGenerate.php, line 74

Class

YamlFormSubmissionGenerate
Form submission generator.

Namespace

Drupal\yamlform

Code

public function getData(YamlFormInterface $yamlform) {
  $elements = $yamlform
    ->getElementsInitializedAndFlattened();
  $data = [];
  foreach ($elements as $key => $element) {
    $value = $this
      ->getTestValue($yamlform, $key, $element);
    if ($value !== NULL) {
      $data[$key] = $value;
    }
  }
  return $data;
}