You are here

public function MaillogSettingsForm::buildForm in Maillog / Mail Developer 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/MaillogSettingsForm.php, line 30

Class

MaillogSettingsForm
Configure file system settings for this site.

Namespace

Drupal\maillog\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('maillog.settings');
  $form = [];
  $form['clear_maillog'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Clear Maillog'),
  ];
  $form['clear_maillog']['clear'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Clear all maillog entries'),
    '#submit' => [
      '::clearLog',
    ],
  ];
  $form['maillog_send'] = [
    '#type' => 'checkbox',
    '#title' => t('Allow the e-mails to be sent.'),
    '#default_value' => $config
      ->get('send'),
  ];
  $form['maillog_log'] = [
    '#type' => 'checkbox',
    '#title' => t('Create table entries in maillog table for each e-mail.'),
    '#default_value' => $config
      ->get('log'),
  ];
  $form['maillog_verbose'] = [
    '#type' => 'checkbox',
    '#title' => t('Display the e-mails on page.'),
    '#default_value' => $config
      ->get('verbose'),
    '#description' => $this
      ->t('If enabled, anonymous users with permissions will see any verbose output mail.'),
  ];
  return parent::buildForm($form, $form_state);
}