You are here

protected function SubscriberForm::getSubmitMessage in Simplenews 8.2

Same name and namespace in other branches
  1. 8 src/Form/SubscriberForm.php \Drupal\simplenews\Form\SubscriberForm::getSubmitMessage()
  2. 3.x src/Form/SubscriberForm.php \Drupal\simplenews\Form\SubscriberForm::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/SubscriberForm.php, line 81

Class

SubscriberForm
Form controller for the subscriber edit forms.

Namespace

Drupal\simplenews\Form

Code

protected function getSubmitMessage(FormStateInterface $form_state, $op, $confirm) {
  if ($this
    ->getFormId() == 'simplenews_subscriber_add_form') {
    return $this
      ->t('Subscriber %label has been added.', [
      '%label' => $this->entity
        ->label(),
    ]);
  }
  return $this
    ->t('Subscriber %label has been updated.', [
    '%label' => $this->entity
      ->label(),
  ]);
}