function UserFormTestHooks::formUserCancelFormAlter

Same name and namespace in other branches
  1. main core/modules/user/tests/modules/user_form_test/src/Hook/UserFormTestHooks.php \Drupal\user_form_test\Hook\UserFormTestHooks::formUserCancelFormAlter()

Implements hook_form_FORM_ID_alter() for user_cancel_form().

Attributes

#[Hook('form_user_cancel_form_alter')]

File

core/modules/user/tests/modules/user_form_test/src/Hook/UserFormTestHooks.php, line 18

Class

UserFormTestHooks
Hook implementations for user_form_test.

Namespace

Drupal\user_form_test\Hook

Code

public function formUserCancelFormAlter(&$form, &$form_state) : void {
  $form['user_cancel_confirm']['#default_value'] = FALSE;
  $form['access']['#value'] = \Drupal::currentUser()->hasPermission('cancel other accounts');
}

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