function _autoassignrole_convert_roles in Auto Assign Role 7.2
Converts the a list of roles that have both keys and values as role name to user_roles() format, taking role IDs as keys.
Parameters
array $roles: Roles to be converted.
Return value
array A list of role names keyed by role id.
2 calls to _autoassignrole_convert_roles()
- autoassignrole_form_user_register_form_alter in ./
autoassignrole.module - Implements hook_form_FORM_ID_alter() for user_register_form().
- autoassignrole_user_presave in ./
autoassignrole.module - Implements hook_user_presave().
File
- ./
autoassignrole.module, line 363 - The main autoassignrole.module file
Code
function _autoassignrole_convert_roles(array $roles) {
return array_filter(user_roles(TRUE), function ($role) use ($roles) {
return !empty($roles[$role]);
});
}