Revert [6835] as it breaks the depth arg. see#5844

git-svn-id: http://svn.automattic.com/wordpress/trunk@6839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-02-14 02:51:12 +00:00
parent 778357c0bc
commit c19d47bb75
1 changed files with 11 additions and 12 deletions

View File

@ -417,6 +417,12 @@ class Walker {
$id_field = $this->db_fields['id']; $id_field = $this->db_fields['id'];
$parent_field = $this->db_fields['parent']; $parent_field = $this->db_fields['parent'];
if ($depth > 0) {
//start the child delimiter
$cb_args = array_merge( array($output, $depth), $args);
$output = call_user_func_array(array(&$this, 'start_lvl'), $cb_args);
}
//display this element //display this element
$cb_args = array_merge( array($output, $element, $depth), $args); $cb_args = array_merge( array($output, $element, $depth), $args);
$output = call_user_func_array(array(&$this, 'start_el'), $cb_args); $output = call_user_func_array(array(&$this, 'start_el'), $cb_args);
@ -426,29 +432,22 @@ class Walker {
$child = $children_elements[$i]; $child = $children_elements[$i];
if ( $child->$parent_field == $element->$id_field ) { if ( $child->$parent_field == $element->$id_field ) {
if ( !isset($newlevel) ) {
$newlevel = true;
//start the child delimiter
$cb_args = array_merge( array($output, $depth), $args);
$output = call_user_func_array(array(&$this, 'start_lvl'), $cb_args);
}
array_splice( $children_elements, $i, 1 ); array_splice( $children_elements, $i, 1 );
$output = $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output ); $output = $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
$i = -1; $i = -1;
} }
} }
if ( isset($newlevel) && $newlevel ){ //end this element
$cb_args = array_merge( array($output, $element, $depth), $args);
$output = call_user_func_array(array(&$this, 'end_el'), $cb_args);
if ($depth > 0) {
//end the child delimiter //end the child delimiter
$cb_args = array_merge( array($output, $depth), $args); $cb_args = array_merge( array($output, $depth), $args);
$output = call_user_func_array(array(&$this, 'end_lvl'), $cb_args); $output = call_user_func_array(array(&$this, 'end_lvl'), $cb_args);
} }
//end this element
$cb_args = array_merge( array($output, $element, $depth), $args);
$output = call_user_func_array(array(&$this, 'end_el'), $cb_args);
return $output; return $output;
} }