public function WebformSubmissionGenerate::getData in Webform 6.x
Same name and namespace in other branches
- 8.5 src/WebformSubmissionGenerate.php \Drupal\webform\WebformSubmissionGenerate::getData()
Generate webform submission data.
Parameters
\Drupal\webform\WebformInterface $webform: The webform this submission will be added to.
Return value
array An associative array containing webform submission data.
Overrides WebformSubmissionGenerateInterface::getData
File
- src/
WebformSubmissionGenerate.php, line 75
Class
- WebformSubmissionGenerate
- Webform submission generator.
Namespace
Drupal\webformCode
public function getData(WebformInterface $webform) {
$elements = $webform
->getElementsInitializedAndFlattened();
$data = [];
foreach ($elements as $key => $element) {
$value = $this
->getTestValue($webform, $key, $element);
if ($value !== NULL) {
$data[$key] = $value;
}
}
return $data;
}