function EntityForm::buildForm
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/EntityForm.php \Drupal\Core\Entity\EntityForm::buildForm()
- 8.9.x core/lib/Drupal/Core/Entity/EntityForm.php \Drupal\Core\Entity\EntityForm::buildForm()
- 11.x core/lib/Drupal/Core/Entity/EntityForm.php \Drupal\Core\Entity\EntityForm::buildForm()
Overrides FormInterface::buildForm
13 calls to EntityForm::buildForm()
- ActionAddForm::buildForm in core/
modules/ action/ src/ Form/ ActionAddForm.php - BlockEntitySettingTrayForm::buildForm in core/
modules/ settings_tray/ src/ Block/ BlockEntitySettingTrayForm.php - Form constructor.
- ContentEntityConfirmFormBase::buildForm in core/
lib/ Drupal/ Core/ Entity/ ContentEntityConfirmFormBase.php - Form constructor.
- DefaultsEntityForm::buildForm in core/
modules/ layout_builder/ src/ Form/ DefaultsEntityForm.php - Form constructor.
- EntityConfirmFormBase::buildForm in core/
lib/ Drupal/ Core/ Entity/ EntityConfirmFormBase.php - Form constructor.
13 methods override EntityForm::buildForm()
- ActionAddForm::buildForm in core/
modules/ action/ src/ Form/ ActionAddForm.php - BlockEntitySettingTrayForm::buildForm in core/
modules/ settings_tray/ src/ Block/ BlockEntitySettingTrayForm.php - Form constructor.
- ContentEntityConfirmFormBase::buildForm in core/
lib/ Drupal/ Core/ Entity/ ContentEntityConfirmFormBase.php - Form constructor.
- DefaultsEntityForm::buildForm in core/
modules/ layout_builder/ src/ Form/ DefaultsEntityForm.php - Form constructor.
- EntityConfirmFormBase::buildForm in core/
lib/ Drupal/ Core/ Entity/ EntityConfirmFormBase.php - Form constructor.
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityForm.php, line 93
Class
- EntityForm
- Base class for entity forms.
Namespace
Drupal\Core\EntityCode
public function buildForm(array $form, FormStateInterface $form_state) {
// During the initial form build, add this form object to the form state and
// allow for initial preparation before form building and processing.
if (!$form_state->has('entity_form_initialized')) {
$this->init($form_state);
}
// Ensure that edit forms have the correct cacheability metadata so they can
// be cached.
if (!$this->entity
->isNew()) {
\Drupal::service('renderer')->addCacheableDependency($form, $this->entity);
}
// Retrieve the form array using the possibly updated entity in form state.
$form = $this->form($form, $form_state);
// Retrieve and add the form actions array.
$actions = $this->actionsElement($form, $form_state);
if (!empty($actions)) {
$form['actions'] = $actions;
}
return $form;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.