function og_subgroups_hs_hierarchical_select_valid_item in Subgroups for Organic groups 6
Implementation of hook_hierarchical_select_valid_item().
File
- modules/
og_subgroups_hs/ og_subgroups_hs.module, line 156 - Implementation of the Hierarchical Select API for the OG Subgroups module.
Code
function og_subgroups_hs_hierarchical_select_valid_item($item, $params) {
if ($item == OG_SUBGROUPS_HS_ANY_OPTION) {
return TRUE;
}
if (!is_numeric($item) || $item < 0) {
return FALSE;
}
// Item 0 corresponds to the <top-level page> option.
if ($item == 0) {
return TRUE;
}
// Fetch the tree
og_subgroups_include('tree');
$tree = og_subgroups_get_tree();
// Flatten the tree
$valid_groups = og_subgroups_flatten_tree($tree);
// Append groups that don't have a family
$valid_groups += og_subgroups_get_groups_without_family();
return in_array($item, array_keys($valid_groups));
}