You are here

public function WebformOptionsCustomForm::afterBuild in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_options_custom/src/WebformOptionsCustomForm.php \Drupal\webform_options_custom\WebformOptionsCustomForm::afterBuild()

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

modules/webform_options_custom/src/WebformOptionsCustomForm.php, line 460

Class

WebformOptionsCustomForm
Provides a form to set webform options custom.

Namespace

Drupal\webform_options_custom

Code

public function afterBuild(array $element, FormStateInterface $form_state) {

  // Overriding after \Drupal\Core\Entity\EntityForm::afterBuild because
  // it calls ::buildEntity(), which calls ::copyFormValuesToEntity, which
  // attempts to populate the entity even though the 'options' have not been
  // validated and set.
  // @see \Drupal\Core\Entity\EntityForm::afterBuild
  // @eee \Drupal\webform_options_custom\WebformOptionsCustomForm::copyFormValuesToEntity
  // @see \Drupal\webform\Element\WebformOptions
  return $element;
}