public function PostmarkSettingsForm::buildForm in Postmark 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 ConfigFormBase::buildForm
File
- src/
Form/ PostmarkSettingsForm.php, line 64
Class
- PostmarkSettingsForm
- Configure Postmark settings.
Namespace
Drupal\postmark\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
// The user's Postmark API key
$form['postmark_api_key'] = [
'#type' => 'textfield',
'#title' => $this
->t('Postmark API Token'),
'#default_value' => $this
->config('postmark.settings')
->get('postmark_api_key'),
'#description' => $this
->t('The Server API token similar to ed742D75-5a45-49b6-a0a1-5b9ec3dc9e5d, generated on the Postmark Server Credentials page.'),
'#required' => TRUE,
];
$form['postmark_sender_signature'] = [
'#type' => 'textfield',
'#title' => $this
->t('Postmark Sender Signature'),
'#default_value' => $this
->config('postmark.settings')
->get('postmark_sender_signature'),
'#description' => $this
->t('The email address configured within Postmark as the Sender Signature for the server associated with the Server API token.'),
'#required' => TRUE,
];
$form['debug'] = [
'#type' => 'details',
'#title' => $this
->t('Debugging'),
'#open' => FALSE,
];
$form['debug']['postmark_debug_mode'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable Postmark debugging'),
'#default_value' => $this
->config('postmark.settings')
->get('postmark_debug_mode'),
];
$form['debug']['postmark_debug_email'] = [
'#type' => 'textfield',
'#title' => $this
->t('Enable Postmark debugging email'),
'#default_value' => $this
->config('postmark.settings')
->get('postmark_debug_email'),
'#description' => $this
->t('Use a debugging email, so all system emails will go to this address. Debugging mode must be on for this to work'),
];
$form['debug']['postmark_debug_no_send'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable Postmark debugging to not send an email and therefore not use a credit'),
'#default_value' => $this
->config('postmark.settings')
->get('postmark_debug_no_send'),
];
$form['test'] = [
'#type' => 'details',
'#title' => $this
->t('Test email'),
'#open' => FALSE,
];
$form['test']['test_address'] = [
'#type' => 'textfield',
'#title' => $this
->t('Recipient'),
'#default_value' => '',
'#description' => $this
->t('Enter a valid email address to send a test email.'),
];
return parent::buildForm($form, $form_state);
}