You are here

function og_get_all_group_entity in Organic groups 7

Same name and namespace in other branches
  1. 7.2 og.module \og_get_all_group_entity()

Return all the enteties that are a group.

Return value

Array keyed with the entity type machine name and the entity human readable name as the value, or an empty array if no entities are defined as group.

3 calls to og_get_all_group_entity()
og_entity_property_info in ./og.module
Implements hook_entity_property_info().
og_rules_condition_info in ./og.rules.inc
Implements hook_rules_condition_info().
og_views_data_alter in includes/og.views.inc
Implements hook_views_data_alter().
1 string reference to 'og_get_all_group_entity'
OgMetadataController::entityPropertyInfo in includes/og.info.inc

File

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

Code

function og_get_all_group_entity() {
  $return = array();
  foreach (entity_get_info() as $entity_type => $entity_value) {
    if (!empty($entity_value['fieldable'])) {
      foreach ($entity_value['bundles'] as $bundle => $bundle_value) {
        if (og_is_group_type($entity_type, $bundle)) {
          $return[$entity_type] = check_plain($entity_value['label']);

          // At least one bundle of the entity can be a group, so break.
          break;
        }
      }
    }
  }
  return $return;
}