protected function WebformSubmissionForm::prepareElements in Webform 8.5
Same name and namespace in other branches
- 6.x src/WebformSubmissionForm.php \Drupal\webform\WebformSubmissionForm::prepareElements()
Prepare webform elements.
Parameters
array $elements: An render array representing elements.
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
1 call to WebformSubmissionForm::prepareElements()
- WebformSubmissionForm::form in src/
WebformSubmissionForm.php - Gets the actual form array to be built.
File
- src/
WebformSubmissionForm.php, line 2533
Class
- WebformSubmissionForm
- Provides a webform to collect and edit submissions.
Namespace
Drupal\webformCode
protected function prepareElements(array &$elements, array &$form, FormStateInterface $form_state) {
foreach ($elements as $key => &$element) {
if (!WebformElementHelper::isElement($element, $key)) {
continue;
}
// Build the webform element.
$this->elementManager
->buildElement($element, $form, $form_state);
if (isset($element['#states'])) {
$element['#states'] = $this
->addStatesPrefix($element['#states']);
}
// Recurse and prepare nested elements.
$this
->prepareElements($element, $form, $form_state);
}
}