function og_subgroups_hs_hierarchical_select_lineage in Subgroups for Organic groups 6
Implementation of hook_hierarchical_select_lineage().
File
- modules/
og_subgroups_hs/ og_subgroups_hs.module, line 130 - Implementation of the Hierarchical Select API for the OG Subgroups module.
Code
function og_subgroups_hs_hierarchical_select_lineage($item, $params) {
og_subgroups_include('tree');
if ($item == OG_SUBGROUPS_HS_ANY_OPTION) {
return array(
$item,
);
}
// create a group object
$group = new stdClass();
$group->nid = $item;
$parents = array_reverse(og_subgroups_get_group_parents($group));
// Append the $group to the end of the lineage
array_push($parents, $group);
// Build the linage in propper array format
$lineage = array();
foreach ($parents as $parent) {
$lineage[] = $parent->nid;
}
return empty($lineage) ? array(
$item,
) : $lineage;
}