You are here

public function AmazonSesVerifyIdentityForm::buildForm in Amazon SES 2.0.x

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 FormInterface::buildForm

File

src/Form/AmazonSesVerifyIdentityForm.php, line 24

Class

AmazonSesVerifyIdentityForm
Amazon SES verify identity form.

Namespace

Drupal\amazon_ses\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $url = Url::fromUri('https://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-addresses-and-domains.html');
  $link = Link::fromTextAndUrl($this
    ->t('Amazon SES documentation'), $url);
  $form['info'] = [
    '#type' => 'markup',
    '#markup' => '<p>' . $this
      ->t('Amazon SES requires verified identies to
        send mail. For more information about verifing identities, see the
        @link.', [
      '@link' => $link
        ->toString(),
    ]) . '</p>',
  ];
  $form['type'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Type'),
    '#description' => $this
      ->t('The type of identity to verify.'),
    '#options' => [
      'domain' => $this
        ->t('Domain'),
      'email' => $this
        ->t('Email address'),
    ],
    '#required' => TRUE,
  ];
  $form['identity'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Identity'),
    '#description' => $this
      ->t('The identity to verify.'),
    '#required' => TRUE,
  ];
  $form['actions'] = [
    '#type' => 'actions',
    'submit' => [
      '#type' => 'submit',
      '#value' => $this
        ->t('Verify'),
    ],
  ];
  return $form;
}