i'm trying to create custom drupal 7 module , i'm using 'user_roles()' function to get all the roles in the system , and then i assign those roles to checkboxes API Form Control
$form['roles_group'] = array(
'#type' => 'checkboxes',
'#options' => drupal_map_assoc(user_roles()),
'#default_value' => isset($field['roles_group']) ? $field['roles_group'] : '',
'#required' => TRUE
);
in the display mode i'm getting a list of checkboxes like this :
<input type="checkbox" id="edit-mtc-roles-utilisateur-anonyme" name="mtc_roles[utilisateur anonyme]" value="utilisateur anonyme" class="form-checkbox">
in the :
name="mtc_roles[utilisateur anonyme]"
the system automatically put the human readable name in the 'Name' attribute of the inputs
and that's makes me wonder if there is a drupal 7 function that can assign a role by the 'human readable name' to a specific user , or do i have to fix attr '#options' in the form checkbox API
PS : the same issue with the content types
thanks in advance ^^