function EntityTestForm::prepareEntity
Same name in other branches
- 9 core/modules/system/tests/modules/entity_test/src/EntityTestForm.php \Drupal\entity_test\EntityTestForm::prepareEntity()
- 10 core/modules/system/tests/modules/entity_test/src/EntityTestForm.php \Drupal\entity_test\EntityTestForm::prepareEntity()
- 11.x core/modules/system/tests/modules/entity_test/src/EntityTestForm.php \Drupal\entity_test\EntityTestForm::prepareEntity()
Overrides ContentEntityForm::prepareEntity
File
-
core/
modules/ system/ tests/ modules/ entity_test/ src/ EntityTestForm.php, line 19
Class
- EntityTestForm
- Form controller for the test entity edit forms.
Namespace
Drupal\entity_testCode
protected function prepareEntity() {
if (empty($this->entity->name->value)) {
// Assign a random name to new EntityTest entities, to avoid repetition in
// tests.
$random = new Random();
$this->entity->name->value = $random->name();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.