You are here

protected function SubscriptionsAccountForm::getSubmitMessage in Simplenews 8.2

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

Class

SubscriptionsAccountForm
Configure simplenews subscriptions of a user.

Namespace

Drupal\simplenews\Form

Code

protected function getSubmitMessage(FormStateInterface $form_state, $op, $confirm) {
  $user = $form_state
    ->get('user');
  if (\Drupal::currentUser()
    ->id() == $user
    ->id()) {
    return $this
      ->t('Your newsletter subscriptions have been updated.');
  }
  return $this
    ->t('The newsletter subscriptions for user %account have been updated.', [
    '%account' => $user
      ->label(),
  ]);
}