function hs_smallhierarchy_hierarchical_select_root_level in Hierarchical Select 5.3
Same name and namespace in other branches
- 6.3 modules/hs_smallhierarchy.module \hs_smallhierarchy_hierarchical_select_root_level()
- 7.3 modules/hs_smallhierarchy.module \hs_smallhierarchy_hierarchical_select_root_level()
Implementation of hook_hierarchical_select_root_level().
File
- modules/
hs_smallhierarchy.module, line 29 - 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_root_level($params) {
$hierarchy = _hs_smallhierarchy_transform($params['hierarchy'], $params['id'], $params['separator']);
$children = $hierarchy['root']['children'];
$level = array();
foreach ($children as $item) {
$level[$item] = $hierarchy[$item]['label'];
}
return $level;
}