You are here

public function AnonymousPublishingClAdminEmail::buildForm in Anonymous Publishing 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

modules/anonymous_publishing_cl/src/Form/AnonymousPublishingClAdminEmail.php, line 29

Class

AnonymousPublishingClAdminEmail
This class defines the email setting form for this module, available at : admin/config/people/anonymous_publishing_cl/mail

Namespace

Drupal\anonymous_publishing_cl\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $settings = $this
    ->config('anonymous_publishing_cl.mail');
  $form['anonymous_publishing_usersec'] = array(
    '#type' => 'details',
    '#open' => TRUE,
    '#title' => 'User email notification',
    '#description' => t('<p>You may edit the following fields to customize the email message sent to non-authenticated users when they create content. One of the first two fields are used for the subject field, the rest may go in the body.</p>'),
  );
  $form['anonymous_publishing_usersec']['email_subject_active'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject (activate content):'),
    '#size' => 72,
    '#maxlength' => 180,
    '#default_value' => $settings
      ->get('email_subject_active'),
    '#parents' => [
      'email_subject_active',
    ],
  );
  $form['anonymous_publishing_usersec']['email_subject_verify'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject (verify email):'),
    '#size' => 72,
    '#maxlength' => 180,
    '#default_value' => $settings
      ->get('email_subject_verify'),
    '#parents' => [
      'email_subject_verify',
    ],
  );
  $form['anonymous_publishing_usersec']['email_introduction'] = array(
    '#type' => 'textarea',
    '#title' => t('Introduction:'),
    '#default_value' => $settings
      ->get('email_introduction'),
    '#cols' => 60,
    '#rows' => 4,
    '#resizable' => FALSE,
    '#parents' => [
      'email_introduction',
    ],
  );
  $form['anonymous_publishing_usersec']['email_activate'] = array(
    '#type' => 'textarea',
    '#title' => t('Text to include if auto-deletion is enabled:'),
    '#default_value' => $settings
      ->get('email_activate'),
    '#cols' => 60,
    '#rows' => 1,
    '#resizable' => FALSE,
    '#parents' => [
      'email_activate',
    ],
  );
  $form['anonymous_publishing_usersec']['email_verify'] = array(
    '#type' => 'textarea',
    '#title' => t('Text to include when administrator approval is  mandatory:'),
    '#default_value' => $settings
      ->get('email_verify'),
    '#cols' => 60,
    '#rows' => 2,
    '#resizable' => FALSE,
    '#parents' => [
      'email_verify',
    ],
  );
  $form['anonymous_publishing_modsec'] = array(
    '#type' => 'details',
    '#open' => TRUE,
    '#title' => 'Admin email notification',
    '#description' => t('<p>You may edit the following fields to customize the email message sent to the administrator when non-authenticated users create content. The first field is the subject, the second is the body.</p>'),
  );
  $form['anonymous_publishing_modsec']['email_admin_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject (admin):'),
    '#default_value' => $settings
      ->get('email_admin_subject'),
    '#size' => 60,
    '#maxlength' => 180,
    '#parents' => [
      'email_admin_subject',
    ],
  );
  $form['anonymous_publishing_modsec']['email_admin_body'] = array(
    '#type' => 'textarea',
    '#title' => t('Body (admin):'),
    '#default_value' => $settings
      ->get('email_admin_body'),
    '#cols' => 60,
    '#rows' => 2,
    '#resizable' => FALSE,
    '#parents' => [
      'email_admin_body',
    ],
  );
  $form['anonymous_publishing_vars'] = array(
    '#markup' => t('<p>You may use the following tokens in the texts above: <code>@action, @autodelhours, @email, @site, @title, @verification_uri.</code></p>'),
  );
  return parent::buildForm($form, $form_state);
}