public function BusinessRulesUtil::getUserRolesOptions in Business Rules 8
Same name and namespace in other branches
- 2.x src/Util/BusinessRulesUtil.php \Drupal\business_rules\Util\BusinessRulesUtil::getUserRolesOptions()
Get all user roles.
Return value
array Options array.
File
- src/
Util/ BusinessRulesUtil.php, line 580
Class
- BusinessRulesUtil
- Class BusinessRulesUtil.
Namespace
Drupal\business_rules\UtilCode
public function getUserRolesOptions() {
$roles = $this->entityTypeManager
->getStorage('user_role')
->loadMultiple();
$options = [];
/**@var \Drupal\user\Entity\Role $role */
foreach ($roles as $role) {
$options[$role
->id()] = $role
->label();
}
asort($options);
return $options;
}