You are here

function hs_smallhierarchy_hierarchical_select_lineage in Hierarchical Select 7.3

Same name and namespace in other branches
  1. 5.3 modules/hs_smallhierarchy.module \hs_smallhierarchy_hierarchical_select_lineage()
  2. 6.3 modules/hs_smallhierarchy.module \hs_smallhierarchy_hierarchical_select_lineage()

Implementation of hook_hierarchical_select_lineage().

File

modules/hs_smallhierarchy.module, line 61
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_lineage($item, $params) {
  $parts = explode($params['separator'], $item);
  $lineage = array();
  for ($i = 0; $i < count($parts); $i++) {
    $lineage[$i] = implode($params['separator'], array_slice($parts, 0, $i + 1));
  }
  return $lineage;
}