function _user_features_get_roles in Features 7.2
Same name and namespace in other branches
- 7 includes/features.user.inc \_user_features_get_roles()
Generate $rid => $role with role names untranslated.
Parameters
bool $builtin: If TRUE, built-in roles like 'anonymous user' and 'authenticated user' will be included.
Return value
string[] Format: $[$rid] = $role_name
3 calls to _user_features_get_roles()
- user_permission_features_rebuild in includes/
features.user.inc - Implements hook_features_rebuild(). Iterate through default permissions and update the permissions map.
- user_role_features_export_options in includes/
features.user.inc - Implements hook_features_export_options().
- _user_features_get_permissions in includes/
features.user.inc - Represent the current state of permissions as a perm to role name array map.
File
- includes/
features.user.inc, line 260 - Features integration for 'user' module.
Code
function _user_features_get_roles($builtin = TRUE) {
$roles = array();
foreach (user_roles() as $rid => $name) {
switch ($rid) {
case DRUPAL_ANONYMOUS_RID:
if ($builtin) {
$roles[$rid] = 'anonymous user';
}
break;
case DRUPAL_AUTHENTICATED_RID:
if ($builtin) {
$roles[$rid] = 'authenticated user';
}
break;
default:
$roles[$rid] = $name;
break;
}
}
return $roles;
}