You are here

protected function SubscriptionsPageForm::getSubmitMessage in Simplenews 8.2

Same name and namespace in other branches
  1. 8 src/Form/SubscriptionsPageForm.php \Drupal\simplenews\Form\SubscriptionsPageForm::getSubmitMessage()
  2. 3.x src/Form/SubscriptionsPageForm.php \Drupal\simplenews\Form\SubscriptionsPageForm::getSubmitMessage()

Returns a message to display to the user upon successful form submission.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: Form state object.

string $op: A string equal to either ::SUBMIT_UPDATE, ::SUBMIT_SUBSCRIBE or ::SUBMIT_UNSUBSCRIBE.

bool $confirm: Whether a confirmation mail is sent or not.

Return value

string A HTML message.

Overrides SubscriptionsFormBase::getSubmitMessage

File

src/Form/SubscriptionsPageForm.php, line 49

Class

SubscriptionsPageForm
Configure simplenews subscriptions of the logged user.

Namespace

Drupal\simplenews\Form

Code

protected function getSubmitMessage(FormStateInterface $form_state, $op, $confirm) {
  if ($confirm) {
    switch ($op) {
      case static::SUBMIT_SUBSCRIBE:
        return $this
          ->t('You will receive a confirmation e-mail shortly containing further instructions on how to complete your subscription.');
      case static::SUBMIT_UNSUBSCRIBE:
        return $this
          ->t('You will receive a confirmation e-mail shortly containing further instructions on how to cancel your subscription.');
    }
  }
  return $this
    ->t('The newsletter subscriptions for %mail have been updated.', [
    '%mail' => $form_state
      ->getValue('mail')[0]['value'],
  ]);
}