function og_subgroups_hs_hierarchical_select_children in Subgroups for Organic groups 6
Implementation of hook_hierarchical_select_children().
File
- modules/
og_subgroups_hs/ og_subgroups_hs.module, line 96 - Implementation of the Hierarchical Select API for the OG Subgroups module.
Code
function og_subgroups_hs_hierarchical_select_children($parent, $params) {
og_subgroups_include('tree');
$children = array();
if (!isset($params['nid'])) {
$params = array(
'nid' => 0,
);
}
// Don't bother getting the children for the group we are viewing
// or if the ANY option was seleted
if ($parent !== $params['nid'] && $parent != OG_SUBGROUPS_HS_ANY_OPTION) {
// Create a group object
$group = new stdClass();
$group->nid = $parent;
// Format the children into an array
$child_groups = og_subgroups_get_group_children($group);
foreach ($child_groups as $gid => $child) {
// Make sure this group can be added as an option
if (!og_subgroups_mask_group($child, TRUE)) {
$children[$child->nid] = $child->title;
}
}
}
return $children;
}