protected function UserBlock::getUsers in Content Planner 8
Loads the users with roles set in config.
Return value
\Drupal\user\Entity\User[] Array of loaded user entities.
1 call to UserBlock::getUsers()
- UserBlock::build in src/
Plugin/ DashboardBlock/ UserBlock.php - Builds the render array for a dashboard block.
File
- src/
Plugin/ DashboardBlock/ UserBlock.php, line 75
Class
- UserBlock
- Provides a user block for Content Planner Dashboard.
Namespace
Drupal\content_planner\Plugin\DashboardBlockCode
protected function getUsers() {
if (isset($this
->getConfiguration()['plugin_specific_config']['roles'])) {
// Get configured roles.
$configured_roles = $this
->getConfiguration()['plugin_specific_config']['roles'];
$query = \Drupal::entityQuery('user');
$query
->condition('roles', array_values($configured_roles), 'in');
$query
->sort('access', 'desc');
$result = $query
->execute();
if ($result) {
return User::loadMultiple($result);
}
}
return [];
}