protected function DirectoryForm::getUsers in Private files download permission 3.x
Same name and namespace in other branches
- 8.2 src/Form/DirectoryForm.php \Drupal\pfdp\Form\DirectoryForm::getUsers()
Retrieves an array of users.
1 call to DirectoryForm::getUsers()
- DirectoryForm::form in src/
Form/ DirectoryForm.php - Gets the actual form array to be built.
File
- src/
Form/ DirectoryForm.php, line 140
Class
- DirectoryForm
- Directory form for private_files_download_permission.
Namespace
Drupal\pfdp\FormCode
protected function getUsers() {
$settings = \Drupal::config('pfdp.settings');
$users = NULL;
// Load user list from cache (if enabled and available).
if ($settings
->get('cache_users') && ($cache = \Drupal::cache()
->get('pfdp.cache.users'))) {
$users = $cache->data;
}
else {
// Get raw data from the database.
$users = \Drupal::database()
->select('users_field_data', 't')
->fields('t', [
'uid',
'name',
])
->orderBy('t.name', 'ASC')
->condition('uid', RoleInterface::ANONYMOUS_ID, '<>')
->execute()
->fetchAllKeyed(0, 1);
// Set cache data.
\Drupal::cache()
->set('pfdp.cache.users', $users);
}
// Return the user list.
return $users;
}