First off, thanks for the module!

A suggestion for improving the developer experience: I would suggest passing the full lineage, not just the final child, in the hooks. For example, hoook_hierarchical_select_children($parent, $params) only passes the direct parent. This is fine when we are dealing with taxonomies or other entities that have a unique ID across all levels in the hierarchy. However, i'm dealing with a situation (I'm sure others are too), where entities at each level have a unqiue ID, but don't have globally unique ID's - so just passing the parent ID doesn't do me any good - I don't know *which* parent it is!

In the long term it would be nice to do: hook_hierarchical_select_children($lineage, $params)
But this wold break API compatibility, so in the shorter term it might make sense to go: hook_hierarchical_select_children($parent, $params, $lineage)

The great thing about passing the whole active lineage is that you can count($lineage) to see how deep you currently are.

For those of you who are running into this problem and need a hacky immediate solution: I embedded the lineage in the value of the child, $options[$parent.'---'.$child_val] = $child_title;, and then parsed the lineage back out again with $lineage= explode('---',$parent);

Comments

phayes’s picture

Category: bug » feature
wim leers’s picture