UserCancelForm::getDescription

public UserCancelForm::getDescription()

Returns additional text to display as a description.

Return value

string The form description.

Overrides ContentEntityConfirmFormBase::getDescription

File

core/modules/user/src/Form/UserCancelForm.php, line 47

Class

UserCancelForm
Provides a confirmation form for cancelling user account.

Namespace

Drupal\user\Form

Code

public function getDescription() {
  $description = '';
  $default_method = $this->config('user.settings')->get('cancel_method');
  if ($this->currentUser()->hasPermission('administer users') || $this->currentUser()->hasPermission('select account cancellation method')) {
    $description = $this->t('Select the method to cancel the account above.');
  }
  // Options supplied via user_cancel_methods() can have a custom
  // #confirm_description property for the confirmation form description.
  elseif (isset($this->cancelMethods[$default_method]['#confirm_description'])) {
    $description = $this->cancelMethods[$default_method]['#confirm_description'];
  }
  return $description . ' ' . $this->t('This action cannot be undone.');
}
doc_Drupal
2016-10-29 09:52:24
Comments
Leave a Comment

Please login to continue.