You are here

function og_label_multiple in Organic groups 7

Get labels out of a list of group IDs.

Parameters

$gids: The group IDs.

$sanitize: TRUE if the label should be sanitzied using filter_xss(). Defaults to TRUE.

Return value

Array keyed with the group ID, and the entity label as the value, or else the group ID with the entity type and entity ID.

3 calls to og_label_multiple()
OGRulesDataUIGroup::optionsList in ./og.rules.inc
og_field_widget_form in ./og.field.inc
Implements hook_field_widget_form().
og_label in ./og.module
Wrapper function; Get the label of a single group.

File

./og.module, line 2270
Enable users to create and manage groups with roles and permissions.

Code

function og_label_multiple($gids = array(), $sanitize = TRUE) {
  $labels = array();
  $groups = og_load_multiple($gids);
  foreach ($groups as $group) {
    if (!empty($group->label)) {
      $labels[$group->gid] = $sanitize ? filter_xss($group->label) : $group->label;
    }
    else {
      $entity = entity_get_info($group->entity_type);
      $param = array(
        '@gid' => $group->gid,
        '@entity' => $entity['label'],
        '@etid' => $group->etid,
      );
      $labels[$group->gid] = t('Group @gid - @entity ID @etid', $param);
    }
  }
  return $labels;
}