You are here

public function MassContactMessageConfirmForm::getQuestion in Mass Contact 8

Returns the question to ask the user.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup The form question. The page title will be set to this value.

Overrides ConfirmFormInterface::getQuestion

File

src/Form/MassContactMessageConfirmForm.php, line 105

Class

MassContactMessageConfirmForm
Form object for the Mass Contact Confirm form.

Namespace

Drupal\mass_contact\Form

Code

public function getQuestion() {
  $recipients = $this->massContact
    ->getrecipients($this->massContactMessage
    ->getCategories(), $this->messageConfigs['respect_opt_out']);
  $recipient_count = count($recipients);
  if ($this->messageConfigs['send_me_copy_user']) {
    if ($recipient_count == 0 || !in_array($this
      ->currentUser()
      ->id(), $recipients)) {
      $recipient_count += 1;
    }
  }
  return $this
    ->t('Are you sure you want to send this message to %user_count user(s)?', [
    '%user_count' => $recipient_count,
  ]);
}