protected function YamlFormSubmissionForm::populateElements in YAML Form 8
Populate form elements.
Parameters
array $elements: An render array representing elements.
array $values: An array of values used to populate the elements.
1 call to YamlFormSubmissionForm::populateElements()
- YamlFormSubmissionForm::form in src/
YamlFormSubmissionForm.php - Gets the actual form array to be built.
File
- src/
YamlFormSubmissionForm.php, line 1264
Class
- YamlFormSubmissionForm
- Provides a form to collect and edit submissions.
Namespace
Drupal\yamlformCode
protected function populateElements(array &$elements, array $values) {
foreach ($elements as $key => &$element) {
if (Element::property($key) || !is_array($element)) {
continue;
}
// Populate element if value exists.
if (isset($element['#type']) && isset($values[$key])) {
$element['#default_value'] = $values[$key];
}
$this
->populateElements($element, $values);
}
}