You are here

function og_subgroups_get_group_children in Subgroups for Organic groups 6

Determine the children of a given group

Parameters

$group: The group object

$nested: TRUE if the returned array should be nested in the structure of the hierarchy. Defaults to TRUE.

Return value

An array of the children of the given group

9 calls to og_subgroups_get_group_children()
og_subgroups_context_condition_has_children::execute in modules/og_subgroups_context/plugins/og_subgroups_context_condition_has_children.inc
Execute the plugin
og_subgroups_delete_group in ./og_subgroups.module
Handle the deletion of a group
og_subgroups_flatten_tree in includes/tree.inc
Flatten the subgroups tree or branch
og_subgroups_force_private_children in ./og_subgroups.module
Force all children of a group to be private
og_subgroups_group_is_child in includes/tree.inc
Determine if a group is the child of a given parent group

... See full list

File

includes/tree.inc, line 201
Functions to generate and use the group hierarchy trees

Code

function og_subgroups_get_group_children($group, $nested = TRUE) {
  static $children = array();
  $output_type = $nested ? 'nested' : 'flat';
  if (!isset($children[$output_type][$group->nid])) {
    $children[$output_type][$group->nid] = array();
    if ($tree = og_subgroups_get_group_tree($group)) {
      _og_subgroups_get_group_children_recursive($group, $tree, $children[$output_type][$group->nid], $nested);
    }
  }
  return isset($children[$output_type][$group->nid]) ? $children[$output_type][$group->nid] : array();
}