diff -r be944660c56a -r 3d72ae0968f4 wp/wp-admin/includes/class-walker-nav-menu-edit.php --- a/wp/wp-admin/includes/class-walker-nav-menu-edit.php Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-admin/includes/class-walker-nav-menu-edit.php Tue Sep 27 16:37:53 2022 +0200 @@ -46,21 +46,26 @@ * * @see Walker_Nav_Menu::start_el() * @since 3.0.0 + * @since 5.9.0 Renamed `$item` to `$data_object` and `$id` to `$current_object_id` + * to match parent class for PHP 8 named parameter support. * * @global int $_wp_nav_menu_max_depth * - * @param string $output Used to append additional content (passed by reference). - * @param WP_Post $item Menu item data object. - * @param int $depth Depth of menu item. Used for padding. - * @param stdClass $args Not used. - * @param int $id Not used. + * @param string $output Used to append additional content (passed by reference). + * @param WP_Post $data_object Menu item data object. + * @param int $depth Depth of menu item. Used for padding. + * @param stdClass $args Not used. + * @param int $current_object_id Optional. ID of the current menu item. Default 0. */ - public function start_el( &$output, $item, $depth = 0, $args = null, $id = 0 ) { + public function start_el( &$output, $data_object, $depth = 0, $args = null, $current_object_id = 0 ) { global $_wp_nav_menu_max_depth; + + // Restores the more descriptive, specific name for use within this method. + $menu_item = $data_object; $_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth; ob_start(); - $item_id = esc_attr( $item->ID ); + $item_id = esc_attr( $menu_item->ID ); $removed_args = array( 'action', 'customlink-tab', @@ -72,18 +77,18 @@ $original_title = false; - if ( 'taxonomy' === $item->type ) { - $original_object = get_term( (int) $item->object_id, $item->object ); + if ( 'taxonomy' === $menu_item->type ) { + $original_object = get_term( (int) $menu_item->object_id, $menu_item->object ); if ( $original_object && ! is_wp_error( $original_object ) ) { $original_title = $original_object->name; } - } elseif ( 'post_type' === $item->type ) { - $original_object = get_post( $item->object_id ); + } elseif ( 'post_type' === $menu_item->type ) { + $original_object = get_post( $menu_item->object_id ); if ( $original_object ) { $original_title = get_the_title( $original_object->ID ); } - } elseif ( 'post_type_archive' === $item->type ) { - $original_object = get_post_type_object( $item->object ); + } elseif ( 'post_type_archive' === $menu_item->type ) { + $original_object = get_post_type_object( $menu_item->object ); if ( $original_object ) { $original_title = $original_object->labels->archives; } @@ -91,23 +96,23 @@ $classes = array( 'menu-item menu-item-depth-' . $depth, - 'menu-item-' . esc_attr( $item->object ), + 'menu-item-' . esc_attr( $menu_item->object ), 'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id === $_GET['edit-menu-item'] ) ? 'active' : 'inactive' ), ); - $title = $item->title; + $title = $menu_item->title; - if ( ! empty( $item->_invalid ) ) { + if ( ! empty( $menu_item->_invalid ) ) { $classes[] = 'menu-item-invalid'; /* translators: %s: Title of an invalid menu item. */ - $title = sprintf( __( '%s (Invalid)' ), $item->title ); - } elseif ( isset( $item->post_status ) && 'draft' === $item->post_status ) { + $title = sprintf( __( '%s (Invalid)' ), $menu_item->title ); + } elseif ( isset( $menu_item->post_status ) && 'draft' === $menu_item->post_status ) { $classes[] = 'pending'; /* translators: %s: Title of a menu item in draft status. */ - $title = sprintf( __( '%s (Pending)' ), $item->title ); + $title = sprintf( __( '%s (Pending)' ), $menu_item->title ); } - $title = ( ! isset( $item->label ) || '' === $item->label ) ? $title : $item->label; + $title = ( ! isset( $menu_item->label ) || '' === $menu_item->label ) ? $title : $menu_item->label; $submenu_text = ''; if ( 0 === $depth ) { @@ -124,7 +129,7 @@ > - type_label ); ?> + type_label ); ?>