function EntityTestForm::form
Same name in other branches
- 9 core/modules/system/tests/modules/entity_test/src/EntityTestForm.php \Drupal\entity_test\EntityTestForm::form()
- 8.9.x core/modules/system/tests/modules/entity_test/src/EntityTestForm.php \Drupal\entity_test\EntityTestForm::form()
- 11.x core/modules/system/tests/modules/entity_test/src/EntityTestForm.php \Drupal\entity_test\EntityTestForm::form()
Overrides ContentEntityForm::form
File
-
core/
modules/ system/ tests/ modules/ entity_test/ src/ EntityTestForm.php, line 31
Class
- EntityTestForm
- Form controller for the test entity edit forms.
Namespace
Drupal\entity_testCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$entity = $this->entity;
// @todo Is there a better way to check if an entity type is revisionable?
if ($entity->getEntityType()
->hasKey('revision') && !$entity->isNew()) {
$form['revision'] = [
'#type' => 'checkbox',
'#title' => t('Create new revision'),
'#default_value' => $entity->isNewRevision(),
];
}
return $form;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.