function group_role_labels in Group 7
Retrieve all group role labels.
Ideally used for populating option lists.
Parameters
bool $prefix_type: (optional) Whether to prefix the group role label with a context label. This is 'Global' for global roles or the group type label otherwise.
Return value
array An array of GroupRole labels, keyed by their machine names.
5 calls to group_role_labels()
- ginvite_by_mail_list in modules/
ginvite/ admin/ ginvite.inc  - Generate the e-mail invitation list.
 - group_group_role_access_settings in plugins/
ctools/ access/ group_role.inc  - Settings form for the group role access plugin.
 - group_group_role_access_summary in plugins/
ctools/ access/ group_role.inc  - Provide a summary description based upon the checked roles.
 - group_handler_field_membership_role::pre_render in views/
handlers/ group_handler_field_membership_role.inc  - Run before any fields are rendered.
 - group_handler_filter_membership_role::get_value_options in views/
handlers/ group_handler_filter_membership_role.inc  - Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.
 
2 string references to 'group_role_labels'
- ggroup_entity_property_info_alter in modules/
ggroup/ ggroup.entity.inc  - Implements hook_entity_property_info_alter().
 - group_entity_property_info in ./
group.entity.inc  - Implements hook_entity_property_info().
 
File
- helpers/
group_role.entity.inc, line 34  - Entity API related helper functions for group roles.
 
Code
function group_role_labels($prefix_type = FALSE) {
  $group_roles = group_roles();
  // Only load the group types if we want to prefix the group role labels.
  if ($prefix_type) {
    $group_types = group_type_labels();
    foreach ($group_roles as &$group_role) {
      $prefix = $group_role->global ? t('Global') : $group_types[$group_role->type];
      $group_role = "{$prefix}: " . $group_role
        ->label();
    }
  }
  else {
    foreach ($group_roles as &$group_role) {
      $group_role = $group_role
        ->label();
    }
  }
  return $group_roles;
}