You are here

function qa_accounts_user_role_insert in QA Accounts 8

Implements hook_ENTITY_TYPE_insert().

Creates a qa user for newly created role, if configured.

File

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

Code

function qa_accounts_user_role_insert(RoleInterface $role) {

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