function EmailExampleGetFormPage::buildForm

Same name in other branches
  1. 3.x modules/email_example/src/Form/EmailExampleGetFormPage.php \Drupal\email_example\Form\EmailExampleGetFormPage::buildForm()

Overrides FormInterface::buildForm

File

modules/email_example/src/Form/EmailExampleGetFormPage.php, line 80

Class

EmailExampleGetFormPage
File test form class.

Namespace

Drupal\email_example\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
    $form['intro'] = [
        '#markup' => $this->t('Use this form to send a message to an e-mail address. No spamming!'),
    ];
    $form['email'] = [
        '#type' => 'textfield',
        '#title' => $this->t('E-mail address'),
        '#required' => TRUE,
    ];
    $form['message'] = [
        '#type' => 'textarea',
        '#title' => $this->t('Message'),
        '#required' => TRUE,
    ];
    $form['submit'] = [
        '#type' => 'submit',
        '#value' => $this->t('Submit'),
    ];
    return $form;
}