WordPress.org

Make WordPress Core

Ticket #39862: Add_tracking_for_total_children.patch

File Add_tracking_for_total_children.patch, 1.1 KB (added by AlexGW, 3 years ago)

Updated patch for class-wp-walker.php

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

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    4747         */
    4848        public $has_children;
    4949
     50        /**
     51         * Total children of current element.
     52         *
     53         * @since 4.7.2
     54         * @var bool
     55         */
     56        public $total_children;
     57
    5058        /**
    5159         * Starts the list before the elements are added.
    5260         *
     
    142150                        $args[0]['has_children'] = $this->has_children; // Back-compat.
    143151                }
    144152
     153                $this->total_children = 0;
     154                if ( $this->has_children ) {
     155                        $this->total_children = count( $children_elements[ $id ] );
     156                }
     157
    145158                $cb_args = array_merge( array(&$output, $element, $depth), $args);
    146159                call_user_func_array(array($this, 'start_el'), $cb_args);
    147160
     
    404417        /**
    405418         * Unset all the children for a given top level element.
    406419         *
    407          * @since 2.7.0
    408          *
    409420         * @param object $e
    410421         * @param array $children_elements
    411422         */