You are here

public function RemoveTeamMemberForm::validateForm in Apigee Edge 8

Form validation handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormBase::validateForm

File

modules/apigee_edge_teams/src/Form/RemoveTeamMemberForm.php, line 132

Class

RemoveTeamMemberForm
Remove team members from.

Namespace

Drupal\apigee_edge_teams\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (!in_array($this->developer
    ->getEmail(), $this->teamMembershipManager
    ->getMembers($this->team
    ->id()))) {
    $form_state
      ->setError($form, $this
      ->t('%developer developer is not member of the %team_name @team.', [
      '%developer' => $this->developer
        ->label(),
      '%team_name' => $this->team
        ->getDisplayName(),
      '@team' => mb_strtolower($this->teamEntityType
        ->getSingularLabel()),
    ]));
    $form_state
      ->setRedirectUrl($this
      ->getCancelUrl());
  }
  parent::validateForm($form, $form_state);
}