Created
November 5, 2013 21:24
-
-
Save ezra-g/7326595 to your computer and use it in GitHub Desktop.
Revisions
-
ezra-g created this gist
Nov 5, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ <?php /** * 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(); }