Commit 06c51c00 authored by Peter Wilson's avatar Peter Wilson

Menus: Fix notices thrown by classes extending `Walker_Nav_Menu`.

Methods in `Walker_Nav_Menu` can be called with multiple, incompatible `$args` objects so an `insset()` check is required to avoid throwing notices.

Introduced in [38523].

Fixes #35206.

Built from https://develop.svn.wordpress.org/trunk@38575


git-svn-id: http://core.svn.wordpress.org/trunk@38518 1a063a9b-81f0-0310-95a4-ce76da25c4cd
parent 6cdab630
......@@ -50,12 +50,12 @@ class Walker_Nav_Menu extends Walker {
* @param stdClass $args An object of wp_nav_menu() arguments.
*/
public function start_lvl( &$output, $depth = 0, $args = array() ) {
if ( 'preserve' === $args->item_spacing ) {
$t = "\t";
$n = "\n";
} else {
if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) {
$t = '';
$n = '';
} else {
$t = "\t";
$n = "\n";
}
$indent = str_repeat( $t, $depth );
$output .= "{$n}{$indent}<ul class=\"sub-menu\">{$n}";
......@@ -73,12 +73,12 @@ class Walker_Nav_Menu extends Walker {
* @param stdClass $args An object of wp_nav_menu() arguments.
*/
public function end_lvl( &$output, $depth = 0, $args = array() ) {
if ( 'preserve' === $args->item_spacing ) {
$t = "\t";
$n = "\n";
} else {
if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) {
$t = '';
$n = '';
} else {
$t = "\t";
$n = "\n";
}
$indent = str_repeat( $t, $depth );
$output .= "$indent</ul>{$n}";
......@@ -99,12 +99,12 @@ class Walker_Nav_Menu extends Walker {
* @param int $id Current item ID.
*/
public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
if ( 'preserve' === $args->item_spacing ) {
$t = "\t";
$n = "\n";
} else {
if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) {
$t = '';
$n = '';
} else {
$t = "\t";
$n = "\n";
}
$indent = ( $depth ) ? str_repeat( $t, $depth ) : '';
......@@ -237,12 +237,12 @@ class Walker_Nav_Menu extends Walker {
* @param stdClass $args An object of wp_nav_menu() arguments.
*/
public function end_el( &$output, $item, $depth = 0, $args = array() ) {
if ( 'preserve' === $args->item_spacing ) {
$t = "\t";
$n = "\n";
} else {
if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) {
$t = '';
$n = '';
} else {
$t = "\t";
$n = "\n";
}
$output .= "</li>{$n}";
}
......
......@@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.7-alpha-38574';
$wp_version = '4.7-alpha-38575';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment