You are here

public function SubscriptionCancelForm::getQuestion in Mailing List 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 ContentEntityDeleteForm::getQuestion

File

src/Form/SubscriptionCancelForm.php, line 46

Class

SubscriptionCancelForm
Builds the form to cancel (delete) subscriptions.

Namespace

Drupal\mailing_list\Form

Code

public function getQuestion() {

  /** @var \Drupal\mailing_list\SubscriptionInterface $subscription */
  $subscription = $this
    ->getEntity();
  $t_args = [
    '%label' => $subscription
      ->label(),
    '%list' => $subscription
      ->getList()
      ->label(),
  ];
  return $this
    ->currentUser()
    ->id() == $subscription
    ->getOwnerId() ? $this
    ->t('Are you sure you want to cancel your subscription %label to the %list mailing list?', $t_args) : $this
    ->t('Are you sure you want to cancel the subscription %label to the %list mailing list?', $t_args);
}