WordPress.org

Make WordPress Core

Ticket #28979: 28979.3.diff

File 28979.3.diff, 3.6 KB (added by celloexpressions, 7 years ago)

Punt WP_Customize_Container to future release and mark WP_Customize_Panel as final in the meantime to avoid potential BC issues. Implement mixed sorting and introduce a containers array in WP_Customize_Manager.

  • src/wp-admin/css/customize-controls.css

     
    132132}
    133133
    134134#customize-theme-controls .control-section:last-of-type.open,
    135 #customize-theme-controls .control-section:last-of-type .accordion-section-title {
     135#customize-theme-controls .control-section:last-of-type > .accordion-section-title {
    136136        border-bottom-color: #ddd;
    137137}
    138138
  • src/wp-admin/customize.php

     
    161161
    162162                        <div id="customize-theme-controls"><ul>
    163163                                <?php
    164                                 foreach ( $wp_customize->panels() as $panel ) {
    165                                         $panel->maybe_render();
     164                                foreach ( $wp_customize->containers() as $container ) {
     165                                        $container->maybe_render();
    166166                                }
    167                                 foreach ( $wp_customize->sections() as $section ) {
    168                                         $section->maybe_render();
    169                                 }
    170167                                ?>
    171168                        </ul></div>
    172169                </div>
  • src/wp-includes/class-wp-customize-manager.php

     
    4343         */
    4444        public $widgets;
    4545
    46         protected $settings = array();
    47         protected $panels   = array();
    48         protected $sections = array();
    49         protected $controls = array();
     46        protected $settings   = array();
     47        protected $containers = array();
     48        protected $panels     = array();
     49        protected $sections   = array();
     50        protected $controls   = array();
    5051
    5152        protected $nonce_tick;
    5253
     
    305306        }
    306307
    307308        /**
     309         * Get the registered containers.
     310         *
     311         * @since 4.0.0
     312         *
     313         * @return array
     314         */
     315        public function containers() {
     316                return $this->containers;
     317        }
     318
     319        /**
    308320         * Get the registered sections.
    309321         *
    310322         * @since 3.4.0
     
    890902                        $panels[] = $panel;
    891903                }
    892904                $this->panels = $panels;
     905
     906                // Sort panels and top-level sections together.
     907                $this->containers = array_merge( $this->panels, $this->sections );
     908                uasort( $this->containers, array( $this, '_cmp_priority' ) );
    893909        }
    894910
    895911        /**
  • src/wp-includes/class-wp-customize-section.php

     
    200200 *
    201201 * A UI container for sections, managed by the WP_Customize_Manager.
    202202 *
     203 * Temporarily final until WP_Customize_Container is implemented.
     204 *
     205 * @link https://core.trac.wordpress.org/ticket/29197
     206 *
    203207 * @package WordPress
    204208 * @subpackage Customize
    205209 * @since 4.0.0
    206210 */
    207 class WP_Customize_Panel extends WP_Customize_Section {
     211final class WP_Customize_Panel extends WP_Customize_Section {
    208212
    209213        /**
    210214         * Customizer sections for this panel.
  • src/wp-includes/class-wp-customize-widgets.php

     
    434434                }
    435435
    436436                $this->manager->add_panel( 'widgets', array(
    437                         'title' => __( 'Widgets' ),
     437                        'title'       => __( 'Widgets' ),
    438438                        'description' => __( 'Widgets are independent sections of content that can be placed into widgetized areas provided by your theme (commonly called sidebars).' ),
     439                        'priority'    => 110,
    439440                ) );
    440441
    441442                foreach ( $sidebars_widgets as $sidebar_id => $sidebar_widget_ids ) {