You are here

protected function SampleCsv::getUserDataWithRole in Bulk User Registration 8

Returns CSV data for users with role. One user per role.

Return value

array Comma separated user data.

1 call to SampleCsv::getUserDataWithRole()
SampleCsv::getCsvData in src/Controller/SampleCsv.php
Returns the sample CSV data.

File

src/Controller/SampleCsv.php, line 49

Class

SampleCsv
Sample CSV controller.

Namespace

Drupal\bulk_user_registration\Controller

Code

protected function getUserDataWithRole() {
  $data = [];
  $allowedRoles = \Drupal::config('bulk_user_registration.settings')
    ->get('allowed_roles');
  foreach (array_filter($allowedRoles) as $role) {
    $data[] = "user_{$role},mail.{$role}@example.com,1,{$role}";
  }
  return $data;
}