You are here

public function TeamForm::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

modules/apigee_edge_teams/src/Entity/Form/TeamForm.php, line 100

Class

TeamForm
General form handler for the team create/edit forms.

Namespace

Drupal\apigee_edge_teams\Entity\Form

Code

public function buildEntity(array $form, FormStateInterface $form_state) {

  /** @var \Drupal\apigee_edge_teams\Entity\TeamInterface $team */
  $team = parent::buildEntity($form, $form_state);

  // ADMIN_EMAIL_ATTRIBUTE is a required field for monetization.
  // We add to any team to make sure team creation works for mint orgs even
  // if they do not enable the m10n teams module.
  $team
    ->setAttribute(static::ADMIN_EMAIL_ATTRIBUTE, $this->currentUser
    ->getEmail());
  return $team;
}