WordPress.org

Make WordPress Core

Ticket #39862: 39862.4.diff

File 39862.4.diff, 1.3 KB (added by welcher, 2 years ago)

Updated patch from root

  • src/wp-includes/class-wp-walker.php

    diff --git src/wp-includes/class-wp-walker.php src/wp-includes/class-wp-walker.php
    index 5ed8aad..51f4fb9 100644
    class Walker { 
    4747        public $has_children;
    4848
    4949        /**
     50         * Total children of current element.
     51         *
     52         * @since 4.7.2
     53         * @var bool
     54         */
     55        public $total_children;
     56
     57        /**
     58         * Total children of current element.
     59         *
     60         * @since 4.7.2
     61         * @var int
     62         */
     63        public $total_children;
     64
     65        /**
    5066         * Starts the list before the elements are added.
    5167         *
    5268         * The $args parameter holds additional values that may be used with the child
    class Walker { 
    140156                if ( isset( $args[0] ) && is_array( $args[0] ) ) {
    141157                        $args[0]['has_children'] = $this->has_children; // Back-compat.
    142158                }
     159               
     160                if ( $this->has_children ) {
     161                        $this->total_children = count( $children_elements[ $id ] );
     162                }
     163
     164                $this->total_children = 0;
     165                if ( $this->has_children ) {
     166                        $this->total_children = count( $children_elements[ $id ] );
     167                }
    143168
    144169                $cb_args = array_merge( array(&$output, $element, $depth), $args);
    145170                call_user_func_array(array($this, 'start_el'), $cb_args);
    class Walker { 
    402427        /**
    403428         * Unset all the children for a given top level element.
    404429         *
    405          * @since 2.7.0
    406          *
    407430         * @param object $e
    408431         * @param array $children_elements
    409432         */