mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
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
This commit is contained in:
parent
6cdab630cd
commit
06c51c0042
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user