diff --git a/modules/apigee_edge_teams/src/Entity/Form/TeamForm.php b/modules/apigee_edge_teams/src/Entity/Form/TeamForm.php index 1157dbd20..c03a4b8fa 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,21 @@ 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); + + // 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; + } + /** * {@inheritdoc} */