public function EntityForm::afterBuild
public EntityForm::afterBuild(array $element, FormStateInterface $form_state)
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.
File
- core/lib/Drupal/Core/Entity/EntityForm.php, line 175
Class
- EntityForm
- Base class for entity forms.
Namespace
Drupal\Core\EntityCode
public function afterBuild(array $element, FormStateInterface $form_state) { // Rebuild the entity if #after_build is being called as part of a form // rebuild, i.e. if we are processing input. if ($form_state->isProcessingInput()) { $this->entity = $this->buildEntity($element, $form_state); } return $element; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityForm.php/function/EntityForm::afterBuild/8.1.x