public function AppForm::buildEntity in Apigee Edge 8
Builds an updated entity object based upon the submitted form values.
For building the updated entity object the form's entity is cloned and the submitted form values are copied to entity properties. The form's entity remains unchanged.
Parameters
array $form: A nested array form elements comprising the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
\Drupal\Core\Entity\EntityInterface An updated copy of the form's entity object.
Overrides EntityForm::buildEntity
See also
\Drupal\Core\Entity\EntityFormInterface::getEntity()
File
- src/
Entity/ Form/ AppForm.php, line 121
Class
- AppForm
- Base entity form for developer- and team (company) app create/edit forms.
Namespace
Drupal\apigee_edge\Entity\FormCode
public function buildEntity(array $form, FormStateInterface $form_state) {
/** @var \Drupal\apigee_edge\Entity\AppInterface $entity */
$entity = parent::buildEntity($form, $form_state);
// Set the owner of the app. Without this an app can not be saved.
// @see \Drupal\apigee_edge\Entity\Controller\DeveloperAppEdgeEntityControllerProxy::create()
$entity
->setAppOwner($form_state
->getValue('owner'));
return $entity;
}