function administerusersbyrole_form_user_cancel_form_alter in Administer Users by Role 8.2
Same name and namespace in other branches
- 8.3 administerusersbyrole.module \administerusersbyrole_form_user_cancel_form_alter()
Implements hook_form_FORM_ID_alter().
Enable cancel delete if required.
File
- ./
administerusersbyrole.module, line 196
Code
function administerusersbyrole_form_user_cancel_form_alter(&$form, &$form_state) {
$user = $form_state
->getFormObject()
->getEntity();
$account = Drupal::currentUser();
if (administerusersbyrole_user_access($user, 'delete', $account)
->isAllowed()) {
$form['user_cancel_method']['user_cancel_delete']['#access'] = TRUE;
}
}