function UserCancelForm::getDescription
Same name in other branches
- 9 core/modules/user/src/Form/UserCancelForm.php \Drupal\user\Form\UserCancelForm::getDescription()
- 8.9.x core/modules/user/src/Form/UserCancelForm.php \Drupal\user\Form\UserCancelForm::getDescription()
- 11.x core/modules/user/src/Form/UserCancelForm.php \Drupal\user\Form\UserCancelForm::getDescription()
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() {
if ($this->selectCancel) {
return '';
}
$default_method = $this->config('user.settings')
->get('cancel_method');
$own_account = $this->entity
->id() == $this->currentUser()
->id();
// Options supplied via user_cancel_methods() can have a custom
// #confirm_description property for the confirmation form description.
// This text refers to "Your account" so only user it if cancelling own account.
if ($own_account && isset($this->cancelMethods[$default_method]['#confirm_description'])) {
return $this->cancelMethods[$default_method]['#confirm_description'];
}
return $this->cancelMethods['#options'][$default_method];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.