/** * Return TRUE if the entity is acting as a group. * * @param $entity_type * The entity type. * @param $entity * The entity object, or the entity ID. */ function og_is_group($entity_type, $entity) { $wrapper = entity_metadata_wrapper($entity_type, $entity); $bundle = $wrapper->getBundle(); if (!field_info_instance($entity_type, OG_GROUP_FIELD, $bundle)) { return variable_get("og_is_group__{$entity_type}__{$bundle}", FALSE); } return !empty($wrapper->{OG_GROUP_FIELD}) && $wrapper->{OG_GROUP_FIELD}->value(); }