You are here

public function PrivateMessageThreadDeleteForm::getQuestion in Private Message 8.2

Same name and namespace in other branches
  1. 8 src/Form/PrivateMessageThreadDeleteForm.php \Drupal\private_message\Form\PrivateMessageThreadDeleteForm::getQuestion()

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/PrivateMessageThreadDeleteForm.php, line 18

Class

PrivateMessageThreadDeleteForm
Form definition for the private message delete form.

Namespace

Drupal\private_message\Form

Code

public function getQuestion() {
  $members = $this
    ->getEntity()
    ->getMembers();
  $member_names = [];
  foreach ($members as $member) {
    if ($member
      ->id() == $this
      ->currentUser()
      ->id()) {
      continue;
    }
    $member_names[] = $member
      ->getDisplayName();
  }
  return $this
    ->t('Are you sure you want to delete the thread between you and the following users: @others?', [
    '@others' => implode(', ', $member_names),
  ]);
}