You are here

public function TestEmailForm::buildForm in Reroute Email 2.x

Same name and namespace in other branches
  1. 8 src/Form/TestEmailForm.php \Drupal\reroute_email\Form\TestEmailForm::buildForm()

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/TestEmailForm.php, line 75

Class

TestEmailForm
Implements a form to test Reroute Email.

Namespace

Drupal\reroute_email\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  return [
    'addresses' => [
      '#type' => 'fieldset',
      '#description' => $this
        ->t('A list of addresses separated by a comma could be submitted.<br/>Email addresses are not validated: any valid or invalid email address format could be submitted.'),
      'to' => [
        '#type' => 'textfield',
        '#title' => $this
          ->t('To'),
        '#required' => TRUE,
      ],
      'cc' => [
        '#type' => 'textfield',
        '#title' => $this
          ->t('Cc'),
      ],
      'bcc' => [
        '#type' => 'textfield',
        '#title' => $this
          ->t('Bcc'),
      ],
    ],
    'subject' => [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Subject'),
      '#default_value' => $this
        ->t('Reroute Email Test'),
    ],
    'body' => [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Body'),
      '#default_value' => $this
        ->t('Reroute Email Body'),
    ],
    'submit' => [
      '#type' => 'submit',
      '#value' => $this
        ->t('Send email'),
    ],
  ];
}