WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/03/2014 09:34:44 PM (7 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-section.php

    r30102 r30214  
    1212
    1313    /**
     14     * Incremented with each new class instantiation, then stored in $instance_number.
     15     *
     16     * Used when sorting two instances whose priorities are equal.
     17     *
     18     * @since 4.1.0
     19     * @access protected
     20     * @var int
     21     */
     22    protected static $instance_count = 0;
     23
     24    /**
     25     * Order in which this instance was created in relation to other instances.
     26     *
     27     * @since 4.1.0
     28     * @access public
     29     * @var int
     30     */
     31    public $instance_number;
     32
     33    /**
    1434     * WP_Customize_Manager instance.
    1535     *
     
    138158            $this->active_callback = array( $this, 'active_callback' );
    139159        }
     160        self::$instance_count += 1;
     161        $this->instance_number = self::$instance_count;
    140162
    141163        $this->controls = array(); // Users cannot customize the $controls array.
     
    195217        $array['content'] = $this->get_content();
    196218        $array['active'] = $this->active();
     219        $array['instanceNumber'] = $this->instance_number;
    197220        return $array;
    198221    }
Note: See TracChangeset for help on using the changeset viewer.