public function TestForm::buildForm in Swift Mailer 8
Same name and namespace in other branches
- 8.2 src/Form/TestForm.php \Drupal\swiftmailer\Form\TestForm::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/ TestForm.php, line 23
Class
- TestForm
- Swift Mailer test form.
Namespace
Drupal\swiftmailer\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['#tree'] = TRUE;
$form['description'] = [
'#markup' => '<p>' . $this
->t('This page allows you to send a test e-mail to a recipient of your choice.') . '</p>',
];
$form['test'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Recipient'),
'#description' => '<p>' . $this
->t('You can send a test e-mail to a recipient of your choice. The e-mail will be sent using the default values as provided by the Swift Mailer module or as configured by you.') . '</p>',
];
$form['test']['recipient'] = [
'#title' => $this
->t('E-mail'),
'#type' => 'textfield',
'#required' => TRUE,
'#default_value' => \Drupal::currentUser()
->getEmail(),
];
$form['actions']['#type'] = 'actions';
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Send'),
'#button_type' => 'primary',
];
return $form;
}