Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / 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   // Limit access to disable account and unpublish content method.
6   $methods['user_cancel_block_unpublish']['access'] = user_access('administer site configuration');
7
8   // Remove the content re-assigning method.
9   unset($methods['user_cancel_reassign']);
10
11   // Add a custom zero-out method.
12   $methods['mymodule_zero_out'] = array(
13     'title' => t('Delete the account and remove all content.'),
14     'description' => t('All your content will be replaced by empty strings.'),
15     // access should be used for administrative methods only.
16     'access' => user_access('access zero-out account cancellation method'),
17   );
18 }