public function YamlFormSubmissionForm::afterBuild in YAML Form 8
Form element #after_build callback: Updates the entity with submitted data.
Updates the internal $this->entity object with submitted values when the form is being rebuilt (e.g. submitted via AJAX), so that subsequent processing (e.g. AJAX callbacks) can rely on it.
Overrides EntityForm::afterBuild
File
- src/
YamlFormSubmissionForm.php, line 476
Class
- YamlFormSubmissionForm
- Provides a form to collect and edit submissions.
Namespace
Drupal\yamlformCode
public function afterBuild(array $form, FormStateInterface $form_state) {
// If form has a custom #action remove Form API fields.
// @see \Drupal\Core\Form\FormBuilder::prepareForm
if (strpos($form['#action'], 'form_action_') === FALSE) {
// Remove 'op' #name from all action buttons.
foreach (Element::children($form['actions']) as $child_key) {
unset($form['actions'][$child_key]['#name']);
}
unset($form['form_build_id'], $form['form_token'], $form['form_id']);
}
return $form;
}