public function EmailConfirmerResponseForm::getQuestion in Email confirmer 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/ EmailConfirmerResponseForm.php, line 89
Class
- EmailConfirmerResponseForm
- Email confirmation response form.
Namespace
Drupal\email_confirmer\FormCode
public function getQuestion() {
/** @var \Drupal\email_confirmer\EmailConfirmationInterface $confirmation */
$confirmation = $this
->getEntity();
$question = '';
switch ($confirmation
->getStatus()) {
case 'pending':
// @todo obfuscate email address if no administer permission, user is anonymous or not owner
$question = $this
->t('Confirm %email', [
'%email' => $this->entity
->label(),
]);
break;
case 'expired':
if ($confirmation
->isConfirmed() || $confirmation
->isCancelled()) {
$question = $this
->t('Already processed');
}
else {
$question = $this
->t('Confirmation expired');
}
break;
case 'cancelled':
$question = $this
->t('Confirmation cancelled');
break;
case 'confirmed':
$question = $this
->t('Confirmation done');
break;
}
return $question;
}