You are here

public function GroupSubscribeForm::getQuestion in Organic groups 8

Get the question to present to the user according to the membership state.

Return value

string The confirmation question.

1 call to GroupSubscribeForm::getQuestion()
GroupSubscribeForm::buildForm in src/Form/GroupSubscribeForm.php

File

src/Form/GroupSubscribeForm.php, line 83

Class

GroupSubscribeForm
Provides a form for subscribing to a group.

Namespace

Drupal\og\Form

Code

public function getQuestion() {

  /** @var \Drupal\og\OgMembershipInterface $membership */
  $membership = $this->entity;

  /** @var EntityInterface $group */
  $group = $membership
    ->getGroup();
  $label = $group
    ->access('view') ? $group
    ->label() : $this
    ->t('Private group');
  $message = $this
    ->isStateActive() ? $this
    ->t('Are you sure you want to join the group %label?', [
    '%label' => $label,
  ]) : $this
    ->t('Are you sure you want to request a subscription to the group %label?', [
    '%label' => $label,
  ]);
  return $message;
}