d445894063a36fdb4a31ffcb27b6369dd17a0cf6
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / user_cancel_methods_alter.twig
1 /**
2  * Implements hook_user_cancel_methods_alter().
3  */
4 function {{ machine_name }}_user_cancel_methods_alter(&$methods) {
5   $account = \Drupal::currentUser();
6   // Limit access to disable account and unpublish content method.
7   $methods['user_cancel_block_unpublish']['access'] = $account->hasPermission('administer site configuration');
8
9   // Remove the content re-assigning method.
10   unset($methods['user_cancel_reassign']);
11
12   // Add a custom zero-out method.
13   $methods['mymodule_zero_out'] = [
14     'title' => t('Delete the account and remove all content.'),
15     'description' => t('All your content will be replaced by empty strings.'),
16     // access should be used for administrative methods only.
17     'access' => $account->hasPermission('access zero-out account cancellation method'),
18   ];
19 }