protected function SubscriptionsBlockForm::getSubmitMessage in Simplenews 8.2
Same name and namespace in other branches
- 8 src/Form/SubscriptionsBlockForm.php \Drupal\simplenews\Form\SubscriptionsBlockForm::getSubmitMessage()
- 3.x src/Form/SubscriptionsBlockForm.php \Drupal\simplenews\Form\SubscriptionsBlockForm::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/ SubscriptionsBlockForm.php, line 79
Class
- SubscriptionsBlockForm
- Configure simplenews subscriptions of the logged user.
Namespace
Drupal\simplenews\FormCode
protected function getSubmitMessage(FormStateInterface $form_state, $op, $confirm) {
switch ($op) {
case static::SUBMIT_UPDATE:
return $this
->t('The newsletter subscriptions for %mail have been updated.', [
'%mail' => $form_state
->getValue('mail')[0]['value'],
]);
case static::SUBMIT_SUBSCRIBE:
if ($confirm) {
return $this
->t('You will receive a confirmation e-mail shortly containing further instructions on how to complete your subscription.');
}
return $this
->t('You have been subscribed.');
case static::SUBMIT_UNSUBSCRIBE:
if ($confirm) {
return $this
->t('You will receive a confirmation e-mail shortly containing further instructions on how to cancel your subscription.');
}
return $this
->t('You have been unsubscribed.');
}
}