You are here

public function SharedEmailSettingsForm::buildForm in Shared Email 8.2

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/SharedEmailSettingsForm.php, line 32

Class

SharedEmailSettingsForm
Class SharedEmailSettingsForm.

Namespace

Drupal\sharedemail\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  // Form constructor.
  $form = parent::buildForm($form, $form_state);

  // Default settings.
  $config = $this
    ->config('sharedemail.settings');

  // Shared email message text field.
  $form['sharedemail_msg'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Shared E-mail message'),
    '#default_value' => $config
      ->get('sharedemail_msg'),
    '#description' => $this
      ->t('Warning message that is only displayed to users with appropriate permission, when they choose to save an e-mail address already used by another user.'),
  ];
  $form['sharedemail_allowed'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Shared E-mail address whitelist'),
    '#default_value' => $config
      ->get('sharedemail_allowed'),
    '#description' => $this
      ->t('Comma separated list of email addresses that may be used to share. Leave blank to allow any.'),
  ];
  return $form;
}