You are here

public function AppApiKeyConfirmFormBase::buildForm in Apigee Edge 8

Form constructor.

Parameters

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

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

Return value

array The form structure.

Overrides ConfirmFormBase::buildForm

File

src/Form/AppApiKeyConfirmFormBase.php, line 64

Class

AppApiKeyConfirmFormBase
Provides a base confirmation form for app API key.

Namespace

Drupal\apigee_edge\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, ?AppInterface $app = NULL, ?string $consumer_key = NULL) {

  // Validate consumer key in app credentials.
  if (!in_array($consumer_key, array_map(function (AppCredential $app_credential) {
    return $app_credential
      ->getConsumerKey();
  }, $app
    ->getCredentials()))) {
    throw new NotFoundHttpException();
  }
  $this->app = $app;
  $this->consumerKey = $consumer_key;
  return parent::buildForm($form, $form_state);
}