diff --git a/modules/apigee_edge_teams/src/Entity/Form/TeamForm.php b/modules/apigee_edge_teams/src/Entity/Form/TeamForm.php index 1157dbd20..de06f6a5e 100644 --- a/modules/apigee_edge_teams/src/Entity/Form/TeamForm.php +++ b/modules/apigee_edge_teams/src/Entity/Form/TeamForm.php @@ -37,6 +37,11 @@ */ class TeamForm extends FieldableEdgeEntityForm implements EdgeEntityFormInterface { + /** + * Admin email attribute name. + */ + const ADMIN_EMAIL_ATTRIBUTE = 'ADMIN_EMAIL'; + /** * The team membership manager service. * @@ -89,6 +94,19 @@ public static function create(ContainerInterface $container) { ); } + /** + * {@inheritdoc} + */ + public function buildEntity(array $form, FormStateInterface $form_state) { + /** @var \Drupal\apigee_edge_teams\Entity\TeamInterface $team */ + $team = parent::buildEntity($form, $form_state); + + // Set the required attributes for the team. + $team->setAttribute(static::ADMIN_EMAIL_ATTRIBUTE, $this->currentUser->getEmail()); + + return $team; + } + /** * {@inheritdoc} */