From 28c07fac73fbb91331574416220fc26b65a415a5 Mon Sep 17 00:00:00 2001
From: jrfnl <jrfnl@users.noreply.github.com>
Date: Sat, 20 Jul 2019 06:50:04 +0200
Subject: [PATCH] Simplify Walker::display_element()
---
src/wp-includes/class-wp-walker.php | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/wp-includes/class-wp-walker.php b/src/wp-includes/class-wp-walker.php
index 4d35b093f5..0a764b9fc8 100644
|
a
|
b
|
class Walker { |
| 141 | 141 | $args[0]['has_children'] = $this->has_children; // Back-compat. |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | | $cb_args = array_merge( array( &$output, $element, $depth ), $args ); |
| 145 | | call_user_func_array( array( $this, 'start_el' ), $cb_args ); |
| | 144 | $this->start_el( $output, $element, $depth, ...array_values( $args ) ); |
| 146 | 145 | |
| 147 | 146 | // descend only when the depth is right and there are childrens for this element |
| 148 | 147 | if ( ( $max_depth == 0 || $max_depth > $depth + 1 ) && isset( $children_elements[ $id ] ) ) { |
| … |
… |
class Walker { |
| 152 | 151 | if ( ! isset( $newlevel ) ) { |
| 153 | 152 | $newlevel = true; |
| 154 | 153 | //start the child delimiter |
| 155 | | $cb_args = array_merge( array( &$output, $depth ), $args ); |
| 156 | | call_user_func_array( array( $this, 'start_lvl' ), $cb_args ); |
| | 154 | $this->start_lvl( $output, $depth, ...array_values( $args ) ); |
| 157 | 155 | } |
| 158 | 156 | $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output ); |
| 159 | 157 | } |
| … |
… |
class Walker { |
| 162 | 160 | |
| 163 | 161 | if ( isset( $newlevel ) && $newlevel ) { |
| 164 | 162 | //end the child delimiter |
| 165 | | $cb_args = array_merge( array( &$output, $depth ), $args ); |
| 166 | | call_user_func_array( array( $this, 'end_lvl' ), $cb_args ); |
| | 163 | $this->end_lvl( $output, $depth, ...array_values( $args ) ); |
| 167 | 164 | } |
| 168 | 165 | |
| 169 | 166 | //end this element |
| 170 | | $cb_args = array_merge( array( &$output, $element, $depth ), $args ); |
| 171 | | call_user_func_array( array( $this, 'end_el' ), $cb_args ); |
| | 167 | $this->end_el( $output, $element, $depth, ...array_values( $args ) ); |
| 172 | 168 | } |
| 173 | 169 | |
| 174 | 170 | /** |