function regcode_og_label in Registration codes 7.2
Same name and namespace in other branches
- 7 regcode_og/regcode_og.module \regcode_og_label()
 
Helper function that returns the labels of multiple groups or a single group.
Parameters
array $gids: This can be an array of group ids or just a single group id.
Return value
array The label for each group.
3 calls to regcode_og_label()
- regcode_og_create in regcode_og/
regcode_og.module  - Form: Create form for og assignment rules.
 - regcode_og_rules_page in regcode_og/
regcode_og.module  - List all of the rules as a HTML table.
 - regcode_og_settings in regcode_og/
regcode_og.module  - Form: Settings form for an og assignment rule.
 
File
- regcode_og/
regcode_og.module, line 299  - Install, uninstall and scheme functions for the regcode_og module.
 
Code
function regcode_og_label($gids) {
  $labels = array();
  // We may want to get the label of a single group by just passing a gid.
  $gids = !is_array($gids) ? array(
    $gids,
  ) : $gids;
  // Load the entities.
  $entities = entity_load_multiple_by_name('node', $gids);
  foreach ($entities as $id => $entity) {
    // Set the label for the current entity.
    $labels[$id] = entity_label('node', $entity);
    // Allow altering the entity label. This is useful if we have sub-groups and
    // those sub-groups have the same name. This will allow appending something
    // to the label to differentiate between them.
    drupal_alter('regcode_og_label', $labels, $entity);
  }
  return $labels;
}