You are here

public function UserCancelForm::getDescription in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/src/Form/UserCancelForm.php \Drupal\user\Form\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 52
Contains \Drupal\user\Form\UserCancelForm.

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.');
  }
  elseif (isset($this->cancelMethods[$default_method]['#confirm_description'])) {
    $description = $this->cancelMethods[$default_method]['#confirm_description'];
  }
  return $description . ' ' . $this
    ->t('This action cannot be undone.');
}