Skip to content

Commit

Permalink
[#211] Add missing ADMIN_EMAIL attribute for Team
Browse files Browse the repository at this point in the history
  • Loading branch information
shadcn committed Feb 7, 2020
1 parent 3b0550d commit c89c4d1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 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,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}
*/
Expand Down

0 comments on commit c89c4d1

Please sign in to comment.