function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output) { if (!$element) { return; } $id_field = $this->db_fields['id']; $id = $element->{$id_field}; parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output); // If we're at the max depth, and the current element still has children, loop over those and display them at this level // This is to prevent them being orphaned to the end of the list. if ($max_depth <= $depth + 1 && isset($children_elements[$id])) { foreach ($children_elements[$id] as $child) { $this->display_element($child, $children_elements, $max_depth, $depth, $args, $output); } unset($children_elements[$id]); } }
function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output) { if (!$element) { return; } $id_field = $this->db_fields['id']; $id = $element->{$id_field}; // we add li tags only in 0 depth comments if ($depth == 0) { ?> <li class="media media-comment"><?php } parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output); // If we're at the max depth, and the current element still has children, loop over those and display them at this level // This is to prevent them being orphaned to the end of the list. if ($max_depth <= $depth + 1 && isset($children_elements[$id])) { foreach ($children_elements[$id] as $child) { $this->display_element($child, $children_elements, $max_depth, $depth, $args, $output); } unset($children_elements[$id]); } // we add li tags only in 0 depth comments if ($depth == 0) { ?> </li><?php } }