public function UserCancelForm::getDescription in Drupal 8
Same name and namespace in other branches
- 9 core/modules/user/src/Form/UserCancelForm.php \Drupal\user\Form\UserCancelForm::getDescription()
- 10 core/modules/user/src/Form/UserCancelForm.php \Drupal\user\Form\UserCancelForm::getDescription()
Returns additional text to display as a description.
Return value
\Drupal\Core\StringTranslation\TranslatableMarkup The form description.
Overrides ContentEntityConfirmFormBase::getDescription
File
- core/
modules/ user/ src/ Form/ UserCancelForm.php, line 56
Class
- UserCancelForm
- Provides a confirmation form for cancelling user account.
Namespace
Drupal\user\FormCode
public function getDescription() {
$description = '';
$default_method = $this
->config('user.settings')
->get('cancel_method');
$own_account = $this->entity
->id() == $this
->currentUser()
->id();
if ($this->selectCancel) {
$description = $this
->t('Select the method to cancel the account above.');
}
elseif ($own_account && isset($this->cancelMethods[$default_method]['#confirm_description'])) {
$description = $this->cancelMethods[$default_method]['#confirm_description'];
}
else {
$description = $this->cancelMethods['#options'][$default_method];
}
return $description . ' ' . $this
->t('This action cannot be undone.');
}