You are here

public static function UserScheme::getUsers in Colors 8

Get users.

Return value

array Array of users keyed by the user id.

File

src/Plugin/colors/type/UserScheme.php, line 55

Class

UserScheme
Provides colors for individual users.

Namespace

Drupal\colors\Plugin\colors\type

Code

public static function getUsers() {
  $users = \Drupal::entityTypeManager()
    ->getStorage('user')
    ->loadMultiple();
  $result = array();
  foreach ($users as $user) {
    if ($user
      ->id()) {
      $result[$user
        ->id()] = $user
        ->getAccountName();
    }
  }
  return $result;
}