You are here

public function LoginDestination::getAllSystemRoles in Login Destination 8.2

Same name and namespace in other branches
  1. 8 src/Entity/LoginDestination.php \Drupal\login_destination\Entity\LoginDestination::getAllSystemRoles()

Get all roles in the system.

Return value

array List of system roles.

1 call to LoginDestination::getAllSystemRoles()
LoginDestination::viewRoles in src/Entity/LoginDestination.php
Prepare list of roles for displaying.

File

src/Entity/LoginDestination.php, line 362

Class

LoginDestination
Defines a login destination configuration entity.

Namespace

Drupal\login_destination\Entity

Code

public function getAllSystemRoles() {
  $role_options = [];
  foreach (user_roles(TRUE) as $role) {
    $role_options[$role
      ->id()] = $role
      ->label();
  }
  return $role_options;
}