function _draggableviews_get_hierarchy_depth in DraggableViews 6
Same name and namespace in other branches
- 6.3 draggableviews.inc \_draggableviews_get_hierarchy_depth()
- 6.2 draggableviews.inc \_draggableviews_get_hierarchy_depth()
- 7 draggableviews.inc \_draggableviews_get_hierarchy_depth()
1 call to _draggableviews_get_hierarchy_depth()
- template_preprocess_draggableviews_view_draggabletable in ./
draggableviews_theme.inc - Display a view as a draggable table style.
File
- ./
draggableviews.inc, line 304 - Implements preprocess function hook_submit for draggable views
Code
function _draggableviews_get_hierarchy_depth($node_id, $result, $parent_field_alias) {
$tmpId = $node_id;
// set temporary id
$depth = -1;
// set depth
//check if nid of current node exists
while ($tmpId > 0 && $depth < 100) {
$depth++;
// get index where nid matches tmpId
if ($index = _draggableviews_get_result_index_by_nid($tmpId, $result)) {
// get parent id
$tmpId = $result[$index]->{$parent_field_alias};
}
else {
break;
}
}
return $depth;
}