You are here

public function ConfirmAddForm::buildForm in Simplenews 8

Same name and namespace in other branches
  1. 8.2 src/Form/ConfirmAddForm.php \Drupal\simplenews\Form\ConfirmAddForm::buildForm()
  2. 3.x src/Form/ConfirmAddForm.php \Drupal\simplenews\Form\ConfirmAddForm::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 ConfirmFormBase::buildForm

File

src/Form/ConfirmAddForm.php, line 53

Class

ConfirmAddForm
Implements a add confirmation form for simplenews subscriptions.

Namespace

Drupal\simplenews\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, $mail = '', NewsletterInterface $newsletter = NULL) {
  $form = parent::buildForm($form, $form_state);
  $form['question'] = array(
    '#markup' => '<p>' . t('Are you sure you want to add %user to the %newsletter mailing list?', array(
      '%user' => simplenews_mask_mail($mail),
      '%newsletter' => $newsletter->name,
    )) . "<p>\n",
  );
  $form['mail'] = array(
    '#type' => 'value',
    '#value' => $mail,
  );
  $form['newsletter'] = array(
    '#type' => 'value',
    '#value' => $newsletter,
  );
  return $form;
}