You are here

function qa_accounts_user_role_delete in QA Accounts 8

Implements hook_ENTITY_TYPE_delete().

Deletes qa user for deleted role, if configured.

File

./qa_accounts.module, line 29
Creates dummy accounts to aid in testing.

Code

function qa_accounts_user_role_delete(RoleInterface $role) {

  // Check configuration to see whether role should be deleted.
  if (!\Drupal::config('qa_accounts.settings')
    ->get('auto_delete_user_per_deleted_role')) {
    return;
  }
  \Drupal::service('qa_accounts.create_delete')
    ->deleteQaAccountForRole($role
    ->id());
}