Make WordPress Core


Ignore:
Timestamp:
11/03/2014 09:34:44 PM (12 years ago)
Author:
ocean90
Message:

Customizer: Add stable sorting for panels, sections and controls in JS. Improve sorting in PHP.

props westonruter.
fixes #30225.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-control.php

    r30172 r30214  
    88 */
    99class WP_Customize_Control {
     10
     11        /**
     12         * Incremented with each new class instantiation, then stored in $instance_number.
     13         *
     14         * Used when sorting two instances whose priorities are equal.
     15         *
     16         * @since 4.1.0
     17         * @access protected
     18         * @var int
     19         */
     20        protected static $instance_count = 0;
     21
     22        /**
     23         * Order in which this instance was created in relation to other instances.
     24         *
     25         * @since 4.1.0
     26         * @access public
     27         * @var int
     28         */
     29        public $instance_number;
     30
    1031        /**
    1132         * @access public
     
    128149                        $this->active_callback = array( $this, 'active_callback' );
    129150                }
     151                self::$instance_count += 1;
     152                $this->instance_number = self::$instance_count;
    130153
    131154                // Process settings.
     
    219242                }
    220243
    221                 $this->json['type']        = $this->type;
    222                 $this->json['priority']    = $this->priority;
    223                 $this->json['active']      = $this->active();
    224                 $this->json['section']     = $this->section;
    225                 $this->json['content']     = $this->get_content();
    226                 $this->json['label']       = $this->label;
     244                $this->json['type'] = $this->type;
     245                $this->json['priority'] = $this->priority;
     246                $this->json['active'] = $this->active();
     247                $this->json['section'] = $this->section;
     248                $this->json['content'] = $this->get_content();
     249                $this->json['label'] = $this->label;
    227250                $this->json['description'] = $this->description;
     251                $this->json['instanceNumber'] = $this->instance_number;
    228252        }
    229253
Note: See TracChangeset for help on using the changeset viewer.