public function Group::getSubgroups in Group 7
Retrieve all subgroups for a group.
This retrieves all descendant subgroups, not just child groups.
Return value
array A list of group entities.
2 calls to Group::getSubgroups()
- Group::getMemberCountRecursive in classes/
group.inc - Get the amount of members in a group, including subgroup members.
- Group::getMembersRecursive in classes/
group.inc - Get all members of a group, including subgroup members.
File
- classes/
group.inc, line 242 - Defines the Entity API class for groups.
Class
- Group
- Main class for groups.
Code
public function getSubgroups() {
drupal_set_message(t('Deprecation notice!<br />Group::getSubgroups() will soon be removed. Please look towards solutions involving the use of use Group::getEntitiesOfType() instead.'), 'warning');
// Get a list of direct child groups.
$subgroups = $this
->getEntitiesOfType('group');
foreach ($subgroups as $group) {
$subgroups += $group
->getSubgroups();
}
return $subgroups;
}