Skip to content

Commit de66aef

Browse files
authored
Merge pull request #328 from arshad/211-set-admin-email-for-team
Add missing ADMIN_EMAIL attribute for Team
2 parents 3b0550d + 877db1b commit de66aef

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

modules/apigee_edge_teams/src/Entity/Form/TeamForm.php

+20
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
*/
3838
class TeamForm extends FieldableEdgeEntityForm implements EdgeEntityFormInterface {
3939

40+
/**
41+
* Admin email attribute name.
42+
*/
43+
const ADMIN_EMAIL_ATTRIBUTE = 'ADMIN_EMAIL';
44+
4045
/**
4146
* The team membership manager service.
4247
*
@@ -89,6 +94,21 @@ public static function create(ContainerInterface $container) {
8994
);
9095
}
9196

97+
/**
98+
* {@inheritdoc}
99+
*/
100+
public function buildEntity(array $form, FormStateInterface $form_state) {
101+
/** @var \Drupal\apigee_edge_teams\Entity\TeamInterface $team */
102+
$team = parent::buildEntity($form, $form_state);
103+
104+
// ADMIN_EMAIL_ATTRIBUTE is a required field for monetization.
105+
// We add to any team to make sure team creation works for mint orgs even
106+
// if they do not enable the m10n teams module.
107+
$team->setAttribute(static::ADMIN_EMAIL_ATTRIBUTE, $this->currentUser->getEmail());
108+
109+
return $team;
110+
}
111+
92112
/**
93113
* {@inheritdoc}
94114
*/

0 commit comments

Comments
 (0)