function ProfileForm::actions

Same name and namespace in other branches
  1. 9 core/modules/user/src/ProfileForm.php \Drupal\user\ProfileForm::actions()
  2. 10 core/modules/user/src/ProfileForm.php \Drupal\user\ProfileForm::actions()
  3. 11.x core/modules/user/src/ProfileForm.php \Drupal\user\ProfileForm::actions()

Overrides EntityForm::actions

File

core/modules/user/src/ProfileForm.php, line 17

Class

ProfileForm
Form handler for the profile forms.

Namespace

Drupal\user

Code

protected function actions(array $form, FormStateInterface $form_state) {
    $element = parent::actions($form, $form_state);
    // The user account being edited.
    $account = $this->entity;
    $element['delete']['#type'] = 'submit';
    $element['delete']['#value'] = $this->t('Cancel account');
    $element['delete']['#submit'] = [
        '::editCancelSubmit',
    ];
    $element['delete']['#access'] = $account->id() > 1 && $account->access('delete');
    return $element;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.