function hs_smallhierarchy_hierarchical_select_valid_item in Hierarchical Select 6.3
Same name and namespace in other branches
- 5.3 modules/hs_smallhierarchy.module \hs_smallhierarchy_hierarchical_select_valid_item()
- 7.3 modules/hs_smallhierarchy.module \hs_smallhierarchy_hierarchical_select_valid_item()
Implementation of hook_hierarchical_select_valid_item().
File
- modules/
hs_smallhierarchy.module, line 75 - Implementation of the Hierarchical Select API that allows one to use a hardcoded hierarchy. When it becomes to slow, you should move the hierarchy into the database and write a proper implementation.
Code
function hs_smallhierarchy_hierarchical_select_valid_item($item, $params) {
$hierarchy = _hs_smallhierarchy_transform($params['hierarchy'], $params['id'], $params['separator']);
// All valid items are in the keys of the $hierarchy array. Only the fake
// "root" item is not a valid item.
$items = array_keys($hierarchy);
unset($items['root']);
return in_array($item, $items);
}