public function ContentEntityForm::form in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/ContentEntityForm.php \Drupal\Core\Entity\ContentEntityForm::form()
- 10 core/lib/Drupal/Core/Entity/ContentEntityForm.php \Drupal\Core\Entity\ContentEntityForm::form()
Gets the actual form array to be built.
Overrides EntityForm::form
See also
\Drupal\Core\Entity\EntityForm::processForm()
\Drupal\Core\Entity\EntityForm::afterBuild()
11 calls to ContentEntityForm::form()
- AccountForm::form in core/
modules/ user/ src/ AccountForm.php - Gets the actual form array to be built.
- BlockContentForm::form in core/
modules/ block_content/ src/ BlockContentForm.php - Gets the actual form array to be built.
- CommentForm::form in core/
modules/ comment/ src/ CommentForm.php - Gets the actual form array to be built.
- EntityTestForm::form in core/
modules/ system/ tests/ modules/ entity_test/ src/ EntityTestForm.php - Gets the actual form array to be built.
- MediaForm::form in core/
modules/ media/ src/ MediaForm.php - Gets the actual form array to be built.
13 methods override ContentEntityForm::form()
- AccountForm::form in core/
modules/ user/ src/ AccountForm.php - Gets the actual form array to be built.
- BlockContentForm::form in core/
modules/ block_content/ src/ BlockContentForm.php - Gets the actual form array to be built.
- BookOutlineForm::form in core/
modules/ book/ src/ Form/ BookOutlineForm.php - Gets the actual form array to be built.
- CommentForm::form in core/
modules/ comment/ src/ CommentForm.php - Gets the actual form array to be built.
- ContentEntityConfirmFormBase::form in core/
lib/ Drupal/ Core/ Entity/ ContentEntityConfirmFormBase.php - Gets the actual form array to be built.
File
- core/
lib/ Drupal/ Core/ Entity/ ContentEntityForm.php, line 101
Class
- ContentEntityForm
- Entity form variant for content entity types.
Namespace
Drupal\Core\EntityCode
public function form(array $form, FormStateInterface $form_state) {
if ($this
->showRevisionUi()) {
// Advanced tab must be the first, because other fields rely on that.
if (!isset($form['advanced'])) {
$form['advanced'] = [
'#type' => 'vertical_tabs',
'#weight' => 99,
];
}
}
$form = parent::form($form, $form_state);
// Content entity forms do not use the parent's #after_build callback
// because they only need to rebuild the entity in the validation and the
// submit handler because Field API uses its own #after_build callback for
// its widgets.
unset($form['#after_build']);
$this
->getFormDisplay($form_state)
->buildForm($this->entity, $form, $form_state);
// Allow modules to act before and after form language is updated.
$form['#entity_builders']['update_form_langcode'] = '::updateFormLangcode';
if ($this
->showRevisionUi()) {
$this
->addRevisionableFormFields($form);
}
$form['footer'] = [
'#type' => 'container',
'#weight' => 99,
'#attributes' => [
'class' => [
'entity-content-form-footer',
],
],
'#optional' => TRUE,
];
return $form;
}