You are here

function og_get_all_group in Organic groups 7.2

Same name and namespace in other branches
  1. 7 og.module \og_get_all_group()

Return all existing groups of an entity type.

File

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

Code

function og_get_all_group($group_type = 'node') {
  if (!field_info_field(OG_GROUP_FIELD)) {
    return array();
  }
  $query = new EntityFieldQuery();
  $return = $query
    ->entityCondition('entity_type', $group_type)
    ->fieldCondition(OG_GROUP_FIELD, 'value', 1, '=')
    ->execute();
  return !empty($return[$group_type]) ? array_keys($return[$group_type]) : array();
}