Skip to content

Commit

Permalink
Merge pull request #328 from arshad/211-set-admin-email-for-team
Browse files Browse the repository at this point in the history
Add missing ADMIN_EMAIL attribute for Team
  • Loading branch information
shadcn authored Feb 10, 2020
2 parents 3b0550d + 877db1b commit de66aef
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions modules/apigee_edge_teams/src/Entity/Form/TeamForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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}
*/
Expand Down

0 comments on commit de66aef

Please sign in to comment.