public function draggableviews_hierarchy_handler_native::get_depth in DraggableViews 7.2
File
- handlers/
draggableviews_hierarchy_handler_native.inc, line 21
Class
Code
public function get_depth($field, $index) {
// $index can be NULL for multiple reasons. Common problem
// is after parent is deleted.
if (!isset($index) || !isset($field->view->result[$index])) {
return;
}
$row = $field->view->result[$index];
// If parent is available, set parent's depth +1.
return !empty($row->draggableviews_structure_parent) ? $this
->get_depth($field, $this
->get_index($field->view, $row->draggableviews_structure_parent)) + 1 : 0;
}