You are here

function og_rules_get_group_content in Organic groups 7.2

Same name and namespace in other branches
  1. 7 og.rules.inc \og_rules_get_group_content()

Action: Fetch group content of a certain entity type.

1 string reference to 'og_rules_get_group_content'
og_rules_action_info in ./og.rules.inc
Implements hook_rules_action_info().

File

./og.rules.inc, line 331
Rules integration for the Organic groups module.

Code

function og_rules_get_group_content(EntityDrupalWrapper $group, $entity_type) {
  $memberships = og_membership_load_multiple(FALSE, array(
    'gid' => $group
      ->getIdentifier(),
    'entity_type' => $entity_type,
  ));
  $entities = array();
  foreach ($memberships as $membership) {
    $entities[] = $membership->etid;
  }
  $entities = entity_load($entity_type, $entities);
  return array(
    'group_content' => $entities,
  );
}